Commit 93760caf6d8b10b166c4f728c689779f588d2644

Authored by Antonio Terceiro
1 parent c8f04c6b

Less strict tests

Showing 1 changed file with 9 additions and 3 deletions   Show diff stats
test/unit/forum_helper_test.rb
... ... @@ -41,7 +41,9 @@ class ForumHelperTest < ActiveSupport::TestCase
41 41 some_post = TextileArticle.create!(:name => 'First post', :profile => profile, :parent => forum, :published => true)
42 42 some_post.expects(:author).returns(author).times(2)
43 43 assert some_post.comments.empty?
44   - assert_match /#{some_post.updated_at.to_s} ago by <a href='[^']+'>forum test author<\/a>/, last_topic_update(some_post)
  44 + out = last_topic_update(some_post)
  45 + assert_match some_post.updated_at.to_s, out
  46 + assert_match /forum test author/, out
45 47 end
46 48  
47 49 should 'return last comment date if it has comments' do
... ... @@ -51,14 +53,18 @@ class ForumHelperTest &lt; ActiveSupport::TestCase
51 53 some_post.comments << Comment.new(:title => 'test', :body => 'test', :author => a2)
52 54 c = Comment.last
53 55 assert_equal 2, some_post.comments.count
54   - assert_match /#{c.created_at.to_s} ago by <a href='[^']+'>a2<\/a>/, last_topic_update(some_post)
  56 + out = last_topic_update(some_post)
  57 + assert_match c.created_at.to_s, out
  58 + assert_match 'a2', out
55 59 end
56 60  
57 61 should "return last comment author's name from unauthenticated user" do
58 62 some_post = TextileArticle.create!(:name => 'First post', :profile => profile, :parent => forum, :published => true)
59 63 some_post.comments << Comment.new(:name => 'John', :email => 'lenon@example.com', :title => 'test', :body => 'test')
60 64 c = Comment.last
61   - assert_match /#{c.created_at.to_s} ago by John/m, last_topic_update(some_post)
  65 + out = last_topic_update(some_post)
  66 + assert_match "#{c.created_at.to_s} ago by John", out
  67 + assert_match 'John', out
62 68 end
63 69  
64 70 protected
... ...