diff options
author | Erik Ostrom <erik@echographia.com> | 2009-09-28 13:31:30 -0500 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2009-09-28 13:31:30 -0500 |
commit | 8ffc2e3b8de38c485fa24820208b40920dad7ae3 (patch) | |
tree | 2eb4160ef48ce6898e0b43f3ab5ed47be4b7dcdd /actionpack/test/template | |
parent | 1696039f29103a6b6bf1e7c274928b302c8c9f31 (diff) | |
download | rails-8ffc2e3b8de38c485fa24820208b40920dad7ae3.tar.gz rails-8ffc2e3b8de38c485fa24820208b40920dad7ae3.tar.bz2 rails-8ffc2e3b8de38c485fa24820208b40920dad7ae3.zip |
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>
Diffstat (limited to 'actionpack/test/template')
-rw-r--r-- | actionpack/test/template/active_record_helper_test.rb | 2 | ||||
-rw-r--r-- | actionpack/test/template/benchmark_helper_test.rb | 12 |
2 files changed, 7 insertions, 7 deletions
diff --git a/actionpack/test/template/active_record_helper_test.rb b/actionpack/test/template/active_record_helper_test.rb index ec3384f15d..c149070f2a 100644 --- a/actionpack/test/template/active_record_helper_test.rb +++ b/actionpack/test/template/active_record_helper_test.rb @@ -185,7 +185,7 @@ class ActiveRecordHelperTest < ActionView::TestCase end def test_form_with_action_option - @response.body = form("post", :action => "sign") + output_buffer << form("post", :action => "sign") assert_select "form[action=sign]" do |form| assert_select "input[type=submit][value=Sign]" end diff --git a/actionpack/test/template/benchmark_helper_test.rb b/actionpack/test/template/benchmark_helper_test.rb index 5d2af7cdd9..ac31fc6503 100644 --- a/actionpack/test/template/benchmark_helper_test.rb +++ b/actionpack/test/template/benchmark_helper_test.rb @@ -4,14 +4,14 @@ require 'action_view/helpers/benchmark_helper' class BenchmarkHelperTest < ActionView::TestCase tests ActionView::Helpers::BenchmarkHelper - def teardown - controller.logger.send(:clear_buffer) + def setup + super + controller.logger = ActiveSupport::BufferedLogger.new(StringIO.new) + controller.logger.auto_flushing = false end - def controller - logger = ActiveSupport::BufferedLogger.new(StringIO.new) - logger.auto_flushing = false - @controller ||= Struct.new(:logger).new(logger) + def teardown + controller.logger.send(:clear_buffer) end def test_without_block |