aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/test_case.rb
Commit message (Collapse)AuthorAgeFilesLines
* Don't define _test_case method if already defined.Emilio Tagua2010-09-281-2/+4
|
* Remove method previous method if already defined.Emilio Tagua2010-09-271-0/+1
|
* Refactor decode_credentials to avoid inject and use map instead.Emilio Tagua2010-09-221-1/+1
| | | | Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
* Perf: refactor _assign method to avoid inject and defining unneeded local var.Emilio Tagua2010-09-221-5/+1
| | | | Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
* Allow view helper's #initialize method to be called. [#5061 state:resolved]Carl Lerche2010-09-131-1/+5
|
* Deletes trailing whitespaces (over text files only find * -type f -exec sed ↵Santiago Pastorino2010-08-141-1/+1
| | | | 's/[ \t]*$//' -i {} \;)
* Moved PolymorphicRoutes to ActionDispatch::RoutingPiotr Sarnacki2010-07-201-1/+1
| | | | Signed-off-by: José Valim <jose.valim@gmail.com>
* Unify routes naming by renaming router to routesPiotr Sarnacki2010-07-021-5/+5
| | | | Signed-off-by: José Valim <jose.valim@gmail.com>
* Convert instance_variables to symbols before excluding internal vars [#4965 ↵rohit2010-06-281-1/+1
| | | | | | state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* Expose view via the view() method in AV::TestCase::BehaviorDavid Chelimsky2010-06-231-5/+8
| | | | | | | | | | - was exposed as _view, which suggested it was private - left _view as an alias of view as not to break any extensions that are relying on _view [#4932 state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* In ActionView::TestCase::Behavior, assign variables right beforeDavid Chelimsky2010-06-231-1/+2
| | | | | | | | | | | rendering the view. - Previously, _assigns were locked down the first time _view was referenced. [#4931 state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* update the list of instance variables that are excluded from assigns in view ↵David Chelimsky2010-06-221-9/+10
| | | | | | | | tests [#4930 state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* Add support for specifying locals in view tests with assert template [#4927 ↵David Chelimsky2010-06-221-0/+15
| | | | | | state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* Merge remote branch 'rails/master'Xavier Noria2010-06-201-0/+1
|\ | | | | | | | | Conflicts: actionpack/lib/abstract_controller/base.rb
| * Support render_template in view tests. Useful for specifying whichDavid Chelimsky2010-06-201-0/+1
| | | | | | | | | | | | | | | | partials are rendered under different conditions. [#4903 state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* | Final touches and fixes.Rizwan Reza2010-06-211-0/+1
|/
* Memoize the object returned by _view in ActionView::TestCase::BehaviorDavid Chelimsky2010-06-081-6/+8
| | | | | | [#4799 state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* In AV::TC, move protect_against_forgery? from the test_case to theDavid Chelimsky2010-06-031-4/+9
| | | | | | | | | | | | | _helper module included in the view. - ensures that protect_against_forgery? is present when a helper included in a partial that is rendered by the template under test calls it (which happens in FormTagHelper#extra_tags_for_form, for example). [#4700 state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* Support configuration of controller.controller_path on instances ofDavid Chelimsky2010-05-261-2/+7
| | | | | | | | | | ActionView::TestCase::TestController without stubs. Just say: @controller.controller_path = "path/i/need/for/this/test" [#4697 state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* Move AV::TC to AV::TC::Behavior [#4678 state:resolved]David Chelimsky2010-05-241-65/+85
| | | | | | | | | | | | - enables alternative testing frameworks to include AV::TC::Behavior instead of subclassing AV::TC - also added tests and code for: - test view delegates :notice to request.flash - useful since generators generate views that use notice - test case doesn't try to include modules that are actually classes Signed-off-by: José Valim <jose.valim@gmail.com>
* refactor evals and adds some __FILE__ and __LINE__Santiago Pastorino2010-05-201-1/+1
| | | | Signed-off-by: José Valim <jose.valim@gmail.com>
* Clean up the config object in ActionPack. Create config_accessor which just ↵José Valim2010-04-221-1/+1
| | | | delegates to the config object, reducing the number of deprecations and add specific tests.
* Missing requireswycats2010-04-161-0/+1
|
* Refactored url_for in AV to have its own instances of the helpers instead of ↵wycats2010-04-031-1/+6
| | | | proxying back to the controller. This potentially allows for more standalone usage of AV. It also kicked up a lot of dust in the tests, which were mocking out controllers to get this behavior. By moving it to the view, it made a lot of the tests more standalone (a win)
* adds missing requires for Object#blank? and Object#present?Xavier Noria2010-03-281-0/+1
|
* Modify assert_template to use notifications. Also, remove ↵Carlhuda2010-03-171-1/+3
| | | | ActionController::Base#template since it is no longer needed.
* Remove unneeded AV::Base and AV::Template monkey-patchesCarlhuda2010-03-171-21/+0
|
* Modify assert_template to use instrumentationCarlhuda2010-03-171-0/+1
|
* Do not always include the named URL helpers into AC::Base and AV::Base.Carl Lerche2010-03-161-1/+2
|
* Make many parts of Rails lazy. In order to facilitate this,wycats2010-03-071-0/+1
| | | | | | | | | | | | add lazy_load_hooks.rb, which allows us to declare code that should be run at some later time. For instance, this allows us to defer requiring ActiveRecord::Base at boot time purely to apply configuration. Instead, we register a hook that should apply configuration once ActiveRecord::Base is loaded. With these changes, brings down total boot time of a new app to 300ms in production and 400ms in dev. TODO: rename base_hook
* Start refactoring the method of configuring ActionViewCarlhuda2010-03-031-0/+4
|
* Tweak the semantic of various URL related methods of ActionDispatch::RequestCarlhuda2010-03-031-0/+2
|
* Fix failing Action Pack testsCarlhuda2010-03-021-1/+1
|
* Revert orphaned SharedTestRoutesJeremy Kemper2010-03-011-2/+1
|
* WIP: Remove the global routerCarlhuda2010-02-251-1/+2
|
* Use ActionDispatch::Routing everywhereMartin Schürrer2010-02-211-1/+1
|
* For performance reasons, you can no longer call html_safe! on Strings. ↵Yehuda Katz2010-01-311-1/+1
| | | | | | | | | | | | Instead, all Strings are always not html_safe?. Instead, you can get a SafeBuffer from a String by calling #html_safe, which will SafeBuffer.new(self). * Additionally, instead of doing concat("</form>".html_safe), you can do safe_concat("</form>"), which will skip both the flag set, and the flag check. * For the first pass, I converted virtually all #html_safe!s to #html_safe, and the tests pass. A further optimization would be to try to use #safe_concat as much as possible, reducing the performance impact if we know up front that a String is safe.
* Require ac/test_case from AV::TestCaseJoshua Peek2010-01-311-0/+2
|
* Autoload AS test caseJoshua Peek2010-01-041-2/+0
|
* Autoload AC and AV test case classesJoshua Peek2010-01-041-1/+0
|
* TestProcess belongs in ADJoshua Peek2009-12-121-2/+1
|
* Reorganize autoloads:Carlhuda2009-12-021-1/+1
| | | | | | | | | | | | | | | | | | | | | * A new module (ActiveSupport::Autoload) is provide that extends autoloading with new behavior. * All autoloads in modules that have extended ActiveSupport::Autoload will be eagerly required in threadsafe environments * Autoloads can optionally leave off the path if the path is the same as full_constant_name.underscore * It is possible to specify that a group of autoloads live under an additional path. For instance, all of ActionDispatch's middlewares are ActionDispatch::MiddlewareName, but they live under "action_dispatch/middlewares/middleware_name" * It is possible to specify that a group of autoloads are all found at the same path. For instance, a number of exceptions might all be declared there. * One consequence of this is that testing-related constants are not autoloaded. To get the testing helpers for a given component, require "component_name/test_case". For instance, "action_controller/test_case". * test_help.rb, which is automatically required by a Rails application's test helper, requires the test_case.rb for all active components, so this change will not be disruptive in existing or new applications.
* Share ActionView::TestCase's output_buffer with view for concat support.Chris Hapgood2009-11-071-0/+1
| | | | | | [#3467 state:resolved] Signed-off-by: Eloy Duran <eloy.de.enige@gmail.com>
* Switch to on-by-default XSS escaping for rails.Michael Koziarski2009-10-081-1/+1
| | | | | | | | | | | | This consists of: * String#html_safe! a method to mark a string as 'safe' * ActionView::SafeBuffer a string subclass which escapes anything unsafe which is concatenated to it * Calls to String#html_safe! throughout the rails helpers * a 'raw' helper which lets you concatenate trusted HTML from non-safety-aware sources (e.g. presantized strings in the DB) * New ERB implementation based on erubis which uses a SafeBuffer instead of a String Hat tip to Django for the inspiration.
* Ported the new ActionView::TestCase from 2-3-stable to master [#3260Erik Ostrom2009-09-281-25/+100
| | | | | | | | | | | | | | | | | state:resolved] The test case now mimicks the template environment more closely, so it's possible to use render, load helper dependencies. This also fixes assert_select, and similar assertions. Because view tests and helpers generally don't render full templates assert_select looks first in rendered and then in output_buffer to find the rendered output. Additional `master'-only changes: Made the Action Pack Rakefile run the ActionView::TestCase tests, and made ActionView::Rendering#_render_text always return a string. Signed-off-by: Joshua Peek <josh@joshpeek.com>
* More perf work:Yehuda Katz2009-08-111-1/+0
| | | | | | | | | | | | | | * Move #set_cookie and #delete_cookie inline to optimize. These optimizations should almost certainly be sent back upstream to Rack. The optimization involves using an ivar for cookies instead of indexing into the headers each time. * Was able to use a bare Hash for headers now that cookies have their own joining semantics (some code assumed that the raw cookies were an Array). * Cache blankness of body on body= * Improve expand_cache_key for Arrays of a single element (common in our case) * Use a simple layout condition check unless conditions are used * Cache visible actions * Lazily load the UrlRewriter * Make etag an ivar that is set on prepare!
* Further experimentation. Was able to cut the cost of rendering 100 partials ↵Yehuda Katz2009-08-111-9/+11
| | | | | | | | | | in a collection in half. To discuss: What are the desired semantics (if any) for layouts in a collection. There are no tests for it at present, and I'm not sure if it's needed at all. Deprecated on this branch: `object` pointing at the current object in partials. You can still use the partial name, or use :as to achieve the same thing. This is obviously up for discussion.
* Modify various partial methods to carry along the block that can be passed ↵Yehuda Katz2009-08-071-2/+2
| | | | | | | | | | in with render * _render_single_template, which renders a template without layout * _render_partial_unknown_type, which renders a partial of unknown type (the entry method for most partial rendering; supports strings, objects, and collections) * _render_partial_object, which renders a partial for a single object. * extracted _render_partial_path so it can be used to render the spacer without going through the public render :partial
* Replace _render_template_with_layout with _render_template since the layout ↵Yehuda Katz2009-08-071-2/+2
| | | | is optional
* Update some tests and add a to_model to form helpersYehuda Katz2009-07-201-0/+1
|