Commit 724a52cb2ff516d608acc0336c2271195607b592

Authored by Victor Costa
1 parent ecf5200d

Fix comment group plugin tests

plugins/comment_group/controllers/profile/comment_group_plugin_profile_controller.rb
1 1 class CommentGroupPluginProfileController < ProfileController
2   - append_view_path File.join(File.dirname(__FILE__) + '/../views')
  2 + append_view_path File.join(File.dirname(__FILE__) + '/../../views')
3 3  
4 4 def view_comments
5 5 @article_id = params[:article_id]
... ...
plugins/comment_group/test/functional/comment_group_plugin_profile_controller_test.rb
... ... @@ -21,25 +21,25 @@ class CommentGroupPluginProfileControllerTest &lt; ActionController::TestCase
21 21 should 'be able to show group comments' do
22 22 comment = fast_create(Comment, :source_id => article, :author_id => profile, :title => 'a comment', :body => 'lalala', :group_id => 0)
23 23 xhr :get, :view_comments, :profile => @profile.identifier, :article_id => article.id, :group_id => 0
24   - assert_template 'comment/_comment.rhtml'
  24 + assert_template 'comment_group_plugin_profile/view_comments.rjs'
25 25 assert_match /comments_list_group_0/, @response.body
26 26 assert_match /\"comment-count-0\", \"1\"/, @response.body
27 27 end
28 28  
29 29 should 'do not show global comments' do
30   - comment = fast_create(Comment, :source_id => article, :author_id => profile, :title => 'global comment', :body => 'global', :group_id => nil)
31   - comment = fast_create(Comment, :source_id => article, :author_id => profile, :title => 'a comment', :body => 'lalala', :group_id => 0)
  30 + fast_create(Comment, :source_id => article, :author_id => profile, :title => 'global comment', :body => 'global', :group_id => nil)
  31 + fast_create(Comment, :source_id => article, :author_id => profile, :title => 'a comment', :body => 'lalala', :group_id => 0)
32 32 xhr :get, :view_comments, :profile => @profile.identifier, :article_id => article.id, :group_id => 0
33   - assert_template 'comment/_comment.rhtml'
  33 + assert_template 'comment_group_plugin_profile/view_comments.rjs'
34 34 assert_match /comments_list_group_0/, @response.body
35 35 assert_match /\"comment-count-0\", \"1\"/, @response.body
36 36 end
37 37  
38 38 should 'show first page comments only' do
39   - comment = fast_create(Comment, :source_id => article, :author_id => profile, :title => 'a comment', :body => 'firstpage 1', :group_id => 0)
40   - comment = fast_create(Comment, :source_id => article, :author_id => profile, :title => 'a comment', :body => 'firstpage 2', :group_id => 0)
41   - comment = fast_create(Comment, :source_id => article, :author_id => profile, :title => 'a comment', :body => 'firstpage 3', :group_id => 0)
42   - comment = fast_create(Comment, :source_id => article, :author_id => profile, :title => 'secondpage', :body => 'secondpage', :group_id => 0)
  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)
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
... ...