Sha256: 21e4c1bd016d334b4ff8d7f2ada2484e581a40544d2db2045a90e70050d814c1

Contents?: true

Size: 1.46 KB

Versions: 11

Compression:

Stored size: 1.46 KB

Contents

require 'abstract_unit'

class Post
  def id
     45 
  end
  def body
    "What a wonderful world!"
  end
end

class RecordTagHelperTest < ActionView::TestCase
  tests ActionView::Helpers::RecordTagHelper

  def setup
    @post = Post.new
  end
  
  def test_content_tag_for
    _erbout = ''
    expected = %(<li class="post bar" id="post_45"></li>)
    actual = content_tag_for(:li, @post, :class => 'bar') { }
    assert_dom_equal expected, actual
  end
  
  def test_content_tag_for_prefix
    _erbout = ''
    expected = %(<ul class="post" id="archived_post_45"></ul>)
    actual = content_tag_for(:ul, @post, :archived) { }
    assert_dom_equal expected, actual    
  end
  
  def test_content_tag_for_with_extra_html_tags
    _erbout = ''
    expected = %(<tr class="post bar" id="post_45" style='background-color: #f0f0f0'></tr>)
    actual = content_tag_for(:tr, @post, {:class => "bar", :style => "background-color: #f0f0f0"}) { }
    assert_dom_equal expected, actual        
  end
  
  def test_block_works_with_content_tag_for
    _erbout = ''
    expected = %(<tr class="post" id="post_45">#{@post.body}</tr>)
    actual = content_tag_for(:tr, @post) { _erbout.concat @post.body }
    assert_dom_equal expected, actual            
  end
  
  def test_div_for    
    _erbout = ''    
    expected = %(<div class="post bar" id="post_45">#{@post.body}</div>)
    actual = div_for(@post, :class => "bar") { _erbout.concat @post.body }
    assert_dom_equal expected, actual
  end  
  
end

Version data entries

11 entries across 11 versions & 5 rubygems

Version Path
radiant-0.7.2 vendor/rails/actionpack/test/template/record_tag_helper_test.rb
vibes-bj-1.2.2 spec/rails_root/vendor/rails/actionpack/test/template/record_tag_helper_test.rb
vibes-bj-1.2.1 spec/rails_root/vendor/rails/actionpack/test/template/record_tag_helper_test.rb
actionpack-2.1.0 test/template/record_tag_helper_test.rb
actionpack-2.1.2 test/template/record_tag_helper_test.rb
actionpack-2.1.1 test/template/record_tag_helper_test.rb
antfarm-0.3.0 rails/vendor/rails/actionpack/test/template/record_tag_helper_test.rb
antfarm-0.4.0 rails/vendor/rails/actionpack/test/template/record_tag_helper_test.rb
eactionpack-2.1.2 test/template/record_tag_helper_test.rb
radiant-0.7.0 vendor/rails/actionpack/test/template/record_tag_helper_test.rb
radiant-0.7.1 vendor/rails/actionpack/test/template/record_tag_helper_test.rb