Commit beb98097664deedb2c8ee37fc264b8f13040b2a9
1 parent
0f84eba8
Exists in
theme-brasil-digital-from-staging
and in
9 other branches
comment_paragraph: update functional tests
Showing
1 changed file
with
9 additions
and
31 deletions
Show diff stats
plugins/comment_paragraph/test/functional/comment_paragraph_plugin_profile_controller_test.rb
| ... | ... | @@ -35,38 +35,16 @@ class CommentParagraphPluginProfileControllerTest < ActionController::TestCase |
| 35 | 35 | assert_match /\"comment-count-0\", \"1\"/, @response.body |
| 36 | 36 | end |
| 37 | 37 | |
| 38 | - should 'show first page comments only' do | |
| 39 | - comment1 = fast_create(Comment, :created_at => Time.now - 1.days, :source_id => article, :author_id => profile, :title => 'a comment', :body => 'secondpage', :paragraph_id => 0) | |
| 40 | - comment2 = fast_create(Comment, :created_at => Time.now - 2.days, :source_id => article, :author_id => profile, :title => 'a comment', :body => 'firstpage 1', :paragraph_id => 0) | |
| 41 | - comment3 = fast_create(Comment, :created_at => Time.now - 3.days, :source_id => article, :author_id => profile, :title => 'a comment', :body => 'firstpage 2', :paragraph_id => 0) | |
| 42 | - comment4 = fast_create(Comment, :created_at => Time.now - 4.days, :source_id => article, :author_id => profile, :title => 'a comment', :body => 'firstpage 3', :paragraph_id => 0) | |
| 38 | + should 'be able to show all comments of a paragraph' do | |
| 39 | + comment1 = fast_create(Comment, :created_at => Time.now - 1.days, :source_id => article, :author_id => profile, :title => 'a comment', :body => 'a comment', :paragraph_id => 0) | |
| 40 | + comment2 = fast_create(Comment, :created_at => Time.now - 2.days, :source_id => article, :author_id => profile, :title => 'b comment', :body => 'b comment', :paragraph_id => 0) | |
| 41 | + comment3 = fast_create(Comment, :created_at => Time.now - 3.days, :source_id => article, :author_id => profile, :title => 'c comment', :body => 'c comment', :paragraph_id => 0) | |
| 42 | + comment4 = fast_create(Comment, :created_at => Time.now - 4.days, :source_id => article, :author_id => profile, :title => 'd comment', :body => 'd comment', :paragraph_id => 0) | |
| 43 | 43 | xhr :get, :view_comments, :profile => @profile.identifier, :article_id => article.id, :paragraph_id => 0 |
| 44 | - assert_match /firstpage 1/, @response.body | |
| 45 | - assert_match /firstpage 2/, @response.body | |
| 46 | - assert_match /firstpage 3/, @response.body | |
| 47 | - assert_no_match /secondpage/, @response.body | |
| 48 | - end | |
| 49 | - | |
| 50 | - should 'show link to display more comments' do | |
| 51 | - comment = fast_create(Comment, :source_id => article, :author_id => profile, :title => 'a comment', :body => 'lalala', :paragraph_id => 0) | |
| 52 | - comment = fast_create(Comment, :source_id => article, :author_id => profile, :title => 'a comment', :body => 'lalala', :paragraph_id => 0) | |
| 53 | - comment = fast_create(Comment, :source_id => article, :author_id => profile, :title => 'a comment', :body => 'lalala', :paragraph_id => 0) | |
| 54 | - comment = fast_create(Comment, :source_id => article, :author_id => profile, :title => 'secondpage', :body => 'secondpage', :paragraph_id => 0) | |
| 55 | - xhr :get, :view_comments, :profile => @profile.identifier, :article_id => article.id, :paragraph_id => 0 | |
| 56 | - assert_match /paragraph_comment_page=2/, @response.body | |
| 57 | - end | |
| 58 | - | |
| 59 | - should 'do not show link to display more comments if do not have more pages' do | |
| 60 | - comment = fast_create(Comment, :source_id => article, :author_id => profile, :title => 'a comment', :body => 'lalala', :paragraph_id => 0) | |
| 61 | - comment = fast_create(Comment, :source_id => article, :author_id => profile, :title => 'a comment', :body => 'lalala', :paragraph_id => 0) | |
| 62 | - comment = fast_create(Comment, :source_id => article, :author_id => profile, :title => 'a comment', :body => 'lalala', :paragraph_id => 0) | |
| 63 | - xhr :get, :view_comments, :profile => @profile.identifier, :article_id => article.id, :paragraph_id => 0 | |
| 64 | - assert_no_match /paragraph_comment_page/, @response.body | |
| 65 | - end | |
| 66 | - | |
| 67 | - should 'do not show link to display more comments if do not have any comments' do | |
| 68 | - xhr :get, :view_comments, :profile => @profile.identifier, :article_id => article.id, :paragraph_id => 0 | |
| 69 | - assert_no_match /paragraph_comment_page/, @response.body | |
| 44 | + assert_match /a comment/, @response.body | |
| 45 | + assert_match /b comment/, @response.body | |
| 46 | + assert_match /c comment/, @response.body | |
| 47 | + assert_match /d comment/, @response.body | |
| 70 | 48 | end |
| 71 | 49 | |
| 72 | 50 | end | ... | ... |