Commit 365042dabe707ea1c2758b7369851e4ae41a998c

Authored by Victor Costa
1 parent 577ce21b

comment_group: fix tests

plugins/comment_group/test/functional/comment_group_plugin_profile_controller_test.rb
@@ -22,8 +22,9 @@ class CommentGroupPluginProfileControllerTest < ActionController::TestCase @@ -22,8 +22,9 @@ class CommentGroupPluginProfileControllerTest < ActionController::TestCase
22 comment = fast_create(Comment, :source_id => article, :author_id => profile, :title => 'a comment', :body => 'lalala', :group_id => 0) 22 comment = fast_create(Comment, :source_id => article, :author_id => profile, :title => 'a comment', :body => 'lalala', :group_id => 0)
23 xhr :get, :view_comments, :profile => @profile.identifier, :article_id => article.id, :group_id => 0 23 xhr :get, :view_comments, :profile => @profile.identifier, :article_id => article.id, :group_id => 0
24 assert_template 'comment_group_plugin_profile/view_comments' 24 assert_template 'comment_group_plugin_profile/view_comments'
25 - assert_match /comments_list_group_0/, @response.body  
26 - assert_match /\"comment-count-0\", \"1\"/, @response.body 25 + assert_select_rjs '#comments_list_group_0'
  26 + assert_select_rjs :replace_html, '#comment-count-0'
  27 + assert_equal 1, assigns(:comments_count)
27 end 28 end
28 29
29 should 'do not show global comments' do 30 should 'do not show global comments' do
@@ -31,8 +32,9 @@ class CommentGroupPluginProfileControllerTest < ActionController::TestCase @@ -31,8 +32,9 @@ class CommentGroupPluginProfileControllerTest < ActionController::TestCase
31 fast_create(Comment, :source_id => article, :author_id => profile, :title => 'a comment', :body => 'lalala', :group_id => 0) 32 fast_create(Comment, :source_id => article, :author_id => profile, :title => 'a comment', :body => 'lalala', :group_id => 0)
32 xhr :get, :view_comments, :profile => @profile.identifier, :article_id => article.id, :group_id => 0 33 xhr :get, :view_comments, :profile => @profile.identifier, :article_id => article.id, :group_id => 0
33 assert_template 'comment_group_plugin_profile/view_comments' 34 assert_template 'comment_group_plugin_profile/view_comments'
34 - assert_match /comments_list_group_0/, @response.body  
35 - assert_match /\"comment-count-0\", \"1\"/, @response.body 35 + assert_select_rjs '#comments_list_group_0'
  36 + assert_select_rjs :replace_html, '#comment-count-0'
  37 + assert_equal 1, assigns(:comments_count)
36 end 38 end
37 39
38 should 'show first page comments only' do 40 should 'show first page comments only' do