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 proposals' do
end
end
scenario 'Show' do
parent_comment = create(:comment, commentable: proposal)
first_child = create(:comment, commentable: proposal, parent: parent_comment)
second_child = create(:comment, commentable: proposal, 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 #{proposal.title}", proposal_path(proposal)
end
scenario 'Comment order' do
c1 = create(:comment, :with_confidence_score, commentable: proposal, cached_votes_up: 100, cached_votes_total: 120, created_at: Time.now - 2)
c2 = create(:comment, :with_confidence_score, commentable: proposal, cached_votes_up: 10, cached_votes_total: 12, created_at: Time.now - 1)