From b64b7d09c0331e04304c4b6c49f5c314f414475f Mon Sep 17 00:00:00 2001 From: Carlos Antonio da Silva Date: Tue, 17 Jan 2012 23:24:17 -0200 Subject: Cleanup Post model, no need to require fake_models --- actionpack/test/template/record_tag_helper_test.rb | 23 ++++++---------------- 1 file changed, 6 insertions(+), 17 deletions(-) (limited to 'actionpack') diff --git a/actionpack/test/template/record_tag_helper_test.rb b/actionpack/test/template/record_tag_helper_test.rb index e7e489b96d..8a9a150910 100644 --- a/actionpack/test/template/record_tag_helper_test.rb +++ b/actionpack/test/template/record_tag_helper_test.rb @@ -1,27 +1,16 @@ require 'abstract_unit' -require 'controller/fake_models' class Post extend ActiveModel::Naming include ActiveModel::Conversion - attr_writer :id, :body + attr_accessor :id, :body def initialize - @id = nil - @body = nil - super + @id = 45 + @body = "What a wonderful world!" - @persisted = true yield self if block_given? end - - def id - @id || 45 - end - - def body - super || @body || "What a wonderful world!" - end end class RecordTagHelperTest < ActionView::TestCase @@ -59,7 +48,7 @@ class RecordTagHelperTest < ActionView::TestCase end def test_block_not_in_erb_multiple_calls - expected = %(
#{@post.body}
) + expected = %(
What a wonderful world!
) actual = div_for(@post, :class => "bar") { @post.body } assert_dom_equal expected, actual actual = div_for(@post, :class => "bar") { @post.body } @@ -67,13 +56,13 @@ class RecordTagHelperTest < ActionView::TestCase end def test_block_works_with_content_tag_for_in_erb - expected = %(#{@post.body}) + expected = %(What a wonderful world!) actual = render_erb("<%= content_tag_for(:tr, @post) do %><%= @post.body %><% end %>") assert_dom_equal expected, actual end def test_div_for_in_erb - expected = %(
#{@post.body}
) + expected = %(
What a wonderful world!
) actual = render_erb("<%= div_for(@post, :class => 'bar') do %><%= @post.body %><% end %>") assert_dom_equal expected, actual end -- cgit v1.2.3