Commit 66c0650c92810a3f8e79d67c0a92b1f9c8111643

Authored by Rodrigo Souto
1 parent e137c34d

comment-group-plugin: avoid randomness on tests

plugins/comment_group/test/functional/comment_group_plugin_profile_controller_test.rb
... ... @@ -36,10 +36,10 @@ class CommentGroupPluginProfileControllerTest < ActionController::TestCase
36 36 end
37 37  
38 38 should 'show first page comments only' do
39   - comment1 = fast_create(Comment, :source_id => article, :author_id => profile, :title => 'a comment', :body => 'secondpage', :group_id => 0)
40   - comment2 = fast_create(Comment, :source_id => article, :author_id => profile, :title => 'a comment', :body => 'firstpage 1', :group_id => 0)
41   - comment3 = fast_create(Comment, :source_id => article, :author_id => profile, :title => 'a comment', :body => 'firstpage 2', :group_id => 0)
42   - comment4 = fast_create(Comment, :source_id => article, :author_id => profile, :title => 'a comment', :body => 'firstpage 3', :group_id => 0)
  39 + comment1 = fast_create(Comment, :source_id => article, :author_id => profile, :title => 'a comment', :created_at => Time.now, :body => 'secondpage', :group_id => 0)
  40 + comment2 = fast_create(Comment, :source_id => article, :author_id => profile, :title => 'a comment', :created_at => Time.now - 1.day, :body => 'firstpage 1', :group_id => 0)
  41 + comment3 = fast_create(Comment, :source_id => article, :author_id => profile, :title => 'a comment', :created_at => Time.now - 2.days, :body => 'firstpage 2', :group_id => 0)
  42 + comment4 = fast_create(Comment, :source_id => article, :author_id => profile, :title => 'a comment', :created_at => Time.now - 3.days, :body => 'firstpage 3', :group_id => 0)
43 43 xhr :get, :view_comments, :profile => @profile.identifier, :article_id => article.id, :group_id => 0
44 44 assert_match /firstpage 1/, @response.body
45 45 assert_match /firstpage 2/, @response.body
... ...