-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Poll comments #1961
Poll comments #1961
Changes from 1 commit
63cbe2f
c3d7d47
8277e3c
2b58875
faa2f31
23397ee
d405d70
37cae41
843048a
ffdbdac
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
On branch mlucena-poll-comments Changes to be committed: modified: app/views/comments/show.html.erb modified: spec/features/polls/polls_spec.rb
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -271,23 +271,67 @@ | |
end | ||
end | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All comment scenarios should be tested https://github.com/consul/consul/tree/master/spec/features/comments There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Either add to the Warning section of this PR that only the basic scenarios have been tested |
||
scenario 'user can reply to comment' do | ||
scenario 'user b can access to comments from user a' do | ||
oliver = create(:user, username: 'Oliver Atom') | ||
benji = create(:user, username: 'Benji Prince') | ||
create(:comment, commentable: poll, user: oliver) | ||
|
||
login_as(oliver) | ||
login_as(benji) | ||
visit poll_path(poll) | ||
|
||
expect(page).to have_content oliver.username | ||
end | ||
|
||
scenario 'user can upvote a comment' do | ||
scenario 'user b can reply to comments from user a', :js do | ||
koji = create(:user, username: 'Koji Kabuto') | ||
sayaka = create(:user, username: 'Sayaka') | ||
comment = create(:comment, commentable: poll, user: koji) | ||
|
||
login_as(sayaka) | ||
visit poll_path(poll) | ||
|
||
click_link "Reply" | ||
|
||
within "#js-comment-form-comment_#{comment.id}" do | ||
fill_in "comment-body-comment_#{comment.id}", with: 'MAZINGER!!.' | ||
click_button 'Publish reply' | ||
end | ||
|
||
within "#comment_#{comment.id}" do | ||
expect(page).to have_content 'MAZINGER!!.' | ||
end | ||
|
||
expect(page).to_not have_selector("#js-comment-form-comment_#{comment.id}", visible: true) | ||
end | ||
|
||
scenario 'user can upvote a comment', :js do | ||
goku = create(:user, username: 'Goku') | ||
vegeta = create(:user, username: 'Vegeta') | ||
comment = create(:comment, commentable: poll, user: goku) | ||
|
||
login_as(vegeta) | ||
visit poll_path(poll) | ||
|
||
within("#comment_#{comment.id}_votes") do | ||
find('.in_favor a').click | ||
|
||
expect(page).to have_content "1 vote" | ||
end | ||
end | ||
|
||
scenario 'user can downvote a comment' do | ||
scenario 'user can downvote a comment', :js do | ||
doraemon = create(:user, username: 'Doraemon') | ||
nobita = create(:user, username: 'Nobi Nobita') | ||
comment = create(:comment, commentable: poll, user: doraemon) | ||
|
||
login_as(nobita) | ||
visit poll_path(poll) | ||
|
||
within("#comment_#{comment.id}_votes") do | ||
find('.against a').click | ||
|
||
expect(page).to have_content "1 vote" | ||
end | ||
end | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
State this in the Warning section too, please