aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/test_case.rb
Commit message (Collapse)AuthorAgeFilesLines
* 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
|
* Make assertion tests pass with the new basePratik Naik2009-05-221-1/+1
|
* Move generic assertions into ActionDispatchJoshua Peek2009-04-301-1/+1
|
* Deprecate template, session, assigns, and layout accessors on response ↵Joshua Peek2009-04-281-2/+3
| | | | object. Instead access them through the controller instance. This mainly affects functional test assertions.
* Refactor ActionView::TemplateYehuda Katz + Carl Lerche2009-04-271-3/+4
| | | | | | | | ActionView::Template is now completely independent from template storage, which allows different back ends such as the database. ActionView::Template's only responsibility is to take in the template source (passed in from ActionView::Path), compile it, and render it.
* Begin unifying the interface between ActionController and ActionViewYehuda Katz2009-01-221-11/+8
|
* Include process methods in ActionController::TestCase only. No need to ↵Jeremy Kemper2009-01-071-0/+1
| | | | alias_method_chain :process either.
* Explicitly require AS::TestCaseJeremy Kemper2009-01-061-0/+2
|
* Fixed ActionView::TestCase current url context [#1561 state:resolved]Dan Pickett2008-12-151-1/+4
| | | | Signed-off-by: Joshua Peek <josh@joshpeek.com>
* Add :partial option to assert_template [#1550 state:resolved]mark2008-12-111-0/+20
| | | | Signed-off-by: Joshua Peek <josh@joshpeek.com>
* Use autoload instead of explicit requires for ActionControllerJoshua Peek2008-11-231-2/+0
|
* Move controller assertions from base TestCase to AC:: and AV::TestCaseJeremy Kemper2008-11-071-1/+3
|
* Get rid of 'Object#send!'. It was originally added because it's in Ruby 1.9, ↵Jeremy Kemper2008-08-311-1/+1
| | | | | | | | | | but it has since been removed from 1.9. Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net> Conflicts: actionpack/test/controller/layout_test.rb
* Include all helpers into ActionView::HelperJoshua Peek2008-08-251-3/+1
|
* Use output_buffer reader and writer methods exclusively instead of hitting ↵Jeremy Kemper2008-06-081-0/+5
| | | | the instance variable so others can override the methods.
* Don't require AV::TestCases to have a helper class. Only include the helper ↵Jeremy Kemper2008-05-261-10/+4
| | | | class in setup if it hasn't been already.
* Introduce ActionView::TestCase for testing view helpers.Joshua Peek2008-04-191-0/+64