Commit Graph

28 Commits

Author SHA1 Message Date
Joshua Peek 2601a16ede Autoload AS test case 2010-01-04 16:22:46 -06:00
Joshua Peek cf83a6f16b Autoload AC and AV test case classes 2010-01-04 16:22:46 -06:00
Joshua Peek ee395fe626 TestProcess belongs in AD 2009-12-12 18:09:44 -06:00
Carlhuda c1304098cc Reorganize autoloads:
* 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.
2009-12-02 20:01:08 -08:00
Chris Hapgood c2cfb20198 Share ActionView::TestCase's output_buffer with view for concat support.
[#3467 state:resolved]

Signed-off-by: Eloy Duran <eloy.de.enige@gmail.com>
2009-11-07 00:42:07 +01:00
Michael Koziarski 9415935902 Switch to on-by-default XSS escaping for rails.
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.
2009-10-08 09:31:20 +13:00
Erik Ostrom 8ffc2e3b8d Ported the new ActionView::TestCase from 2-3-stable to master [#3260
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>
2009-09-28 13:31:30 -05:00
Yehuda Katz 4bf516e072 More perf work:
* 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!
2009-08-11 15:03:53 -07:00
Yehuda Katz 4945d82239 Further experimentation. Was able to cut the cost of rendering 100 partials 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.
2009-08-11 15:03:53 -07:00
Yehuda Katz 493d84ce2f Modify various partial methods to carry along the block that can be passed 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
2009-08-07 05:40:01 -03:00
Yehuda Katz 0612fd0f09 Replace _render_template_with_layout with _render_template since the layout is optional 2009-08-07 03:18:45 -03:00
Yehuda Katz 13e18dd940 Update some tests and add a to_model to form helpers 2009-07-20 00:58:59 +09:00
Pratik Naik 9d08f86cd4 Make assertion tests pass with the new base 2009-05-22 19:01:52 +02:00
Joshua Peek 7b3b7cb2ab Move generic assertions into ActionDispatch 2009-04-30 11:55:53 -05:00
Joshua Peek c0a372ba87 Deprecate template, session, assigns, and layout accessors on response object. Instead access them through the controller instance. This mainly affects functional test assertions. 2009-04-28 23:29:46 -05:00
Yehuda Katz + Carl Lerche cecafc52ee Refactor ActionView::Template
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.
2009-04-27 11:49:11 -07:00
Yehuda Katz eb9af20b7c Begin unifying the interface between ActionController and ActionView 2009-01-22 16:18:10 -06:00
Jeremy Kemper 35fa007313 Include process methods in ActionController::TestCase only. No need to alias_method_chain :process either. 2009-01-07 14:49:05 -08:00
Jeremy Kemper 84194ce936 Explicitly require AS::TestCase 2009-01-06 15:35:46 -08:00
Dan Pickett 38412ecb5d Fixed ActionView::TestCase current url context [#1561 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2008-12-15 11:47:39 -06:00
mark 49306ccacf Add :partial option to assert_template [#1550 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2008-12-11 11:06:35 -06:00
Joshua Peek 31ce92f7b5 Use autoload instead of explicit requires for ActionController 2008-11-23 16:35:47 -06:00
Jeremy Kemper c82e8e1f48 Move controller assertions from base TestCase to AC:: and AV::TestCase 2008-11-07 15:42:34 -05:00
Jeremy Kemper a1eb4e11c2 Get rid of 'Object#send!'. It was originally added because it's in Ruby 1.9, but it has since been removed from 1.9.
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>

Conflicts:

	actionpack/test/controller/layout_test.rb
2008-08-31 13:20:15 -07:00
Joshua Peek ba0d621695 Include all helpers into ActionView::Helper 2008-08-25 21:50:26 -05:00
Jeremy Kemper ff5f155f8d Use output_buffer reader and writer methods exclusively instead of hitting the instance variable so others can override the methods. 2008-06-08 20:05:39 -07:00
Jeremy Kemper 7520770c82 Don't require AV::TestCases to have a helper class. Only include the helper class in setup if it hasn't been already. 2008-05-26 01:38:56 -07:00
Joshua Peek 17d4164a16 Introduce ActionView::TestCase for testing view helpers. 2008-04-19 13:08:24 -05:00