adds comment show view

This commit is contained in:
rgarcia
2016-01-07 14:19:05 +01:00
parent 5e9240e25c
commit 816a95b7b7
11 changed files with 69 additions and 11 deletions

View File

@@ -20,6 +20,21 @@ feature 'Commenting debates' do
end
end
scenario 'Show' do
parent_comment = create(:comment, commentable: debate)
first_child = create(:comment, commentable: debate, parent: parent_comment)
second_child = create(:comment, commentable: debate, parent: parent_comment)
visit comment_path(parent_comment)
expect(page).to have_css(".comment", count: 3)
expect(page).to have_content parent_comment.body
expect(page).to have_content first_child.body
expect(page).to have_content second_child.body
expect(page).to have_link "Go back to #{debate.title}", debate_path(debate)
end
scenario 'Comment order' do
c1 = create(:comment, :with_confidence_score, commentable: debate, cached_votes_up: 100, cached_votes_total: 120, created_at: Time.now - 2)
c2 = create(:comment, :with_confidence_score, commentable: debate, cached_votes_up: 10, cached_votes_total: 12, created_at: Time.now - 1)
@@ -254,7 +269,7 @@ feature 'Commenting debates' do
fill_in "comment-body-debate_#{debate.id}", with: 'Testing submit button!'
click_button 'Publish comment'
# The button's text should now be "..."
# This should be checked before the Ajax request is finished
expect(page).to_not have_button 'Publish comment'