Commit a07fe0f0e34f74ab96b621e3d9e34acf1c2cf1d0
1 parent
569ed945
Exists in
master
and in
28 other branches
Fix a ForumHelper test
The test relied on updating the date, which for some reason din't work. Stubbing Time.now solved the problem.
Showing
1 changed file
with
2 additions
and
1 deletions
Show diff stats
test/unit/forum_helper_test.rb
... | ... | @@ -30,8 +30,9 @@ class ForumHelperTest < ActiveSupport::TestCase |
30 | 30 | |
31 | 31 | should 'list posts with different classes' do |
32 | 32 | forum.children << older_post = TextileArticle.create!(:name => 'First post', :profile => profile, :parent => forum, :published => false) |
33 | + one_month_later = Time.now + 1.month | |
34 | + Time.stubs(:now).returns(one_month_later) | |
33 | 35 | forum.children << newer_post = TextileArticle.create!(:name => 'Second post', :profile => profile, :parent => forum, :published => true) |
34 | - older_post.updated_at = Time.now.ago(1.month); older_post.send(:update_without_callbacks) | |
35 | 36 | assert_match /forum-post position-1 first odd-post.*forum-post position-2 last not-published even-post/, list_forum_posts(forum.posts) |
36 | 37 | end |
37 | 38 | ... | ... |