Commit 2716f355dd584bb25ea9c5029665ef5a44cfc2c7
1 parent
c995df4c
Exists in
master
and in
28 other branches
The actual HTML generated by Rails 2.3.5 changed
Fixing tests to first parse the HTML and then test the contents, instead of rellying in the exact markup
Showing
2 changed files
with
3 additions
and
3 deletions
Show diff stats
test/unit/cms_helper_test.rb
... | ... | @@ -16,8 +16,8 @@ class CmsHelperTest < ActiveSupport::TestCase |
16 | 16 | should 'show custom options for blog' do |
17 | 17 | CmsHelperTest.any_instance.stubs(:controller).returns(ActionController::Base.new) |
18 | 18 | result = options_for_article(Blog.new) |
19 | - assert_match /id="article\[published\]" name="article\[published\]" type="hidden" value="1"/, result | |
20 | - assert_match /id="article\[accept_comments\]" name="article\[accept_comments\]" type="hidden" value="0"/, result | |
19 | + assert_tag_in_string result, :tag => 'input', :attributes => { :name => 'article[published]' , :type => "hidden", :value => "1" } | |
20 | + assert_tag_in_string result, :tag => 'input', :attributes => { :name => "article[accept_comments]", :type => "hidden", :value => "0" } | |
21 | 21 | end |
22 | 22 | |
23 | 23 | should 'display link to folder content if article is folder' do | ... | ... |
test/unit/link_list_block_test.rb
... | ... | @@ -64,7 +64,7 @@ class LinkListBlockTest < ActiveSupport::TestCase |
64 | 64 | |
65 | 65 | should 'not add link to onclick' do |
66 | 66 | l = LinkListBlock.new(:links => [{:name => 'link', :address => "#\" onclick=\"alert(123456)"}]) |
67 | - assert_no_match /onclick/, l.link_html(l.links.first) | |
67 | + assert_no_tag_in_string l.link_html(l.links.first), :attributes => { :onclick => /.*/ } | |
68 | 68 | end |
69 | 69 | |
70 | 70 | should 'add http in front of incomplete external links' do | ... | ... |