adds css classes to voted options in debates
for logged users. Closes #88
This commit is contained in:
@@ -13,6 +13,53 @@ feature 'Votes' do
|
||||
visit debate_path(@debate)
|
||||
end
|
||||
|
||||
scenario "Index show user votes on debates" do
|
||||
debate1 = create(:debate)
|
||||
debate2 = create(:debate)
|
||||
debate3 = create(:debate)
|
||||
vote = create(:vote, voter: @manuela, votable: debate1, vote_flag: true)
|
||||
vote = create(:vote, voter: @manuela, votable: debate3, vote_flag: false)
|
||||
|
||||
visit debates_path
|
||||
|
||||
within("#debate_#{debate1.id}_votes") do
|
||||
within(".in-favor") do
|
||||
expect(page).to have_css("a.voted")
|
||||
expect(page).to_not have_css("a.no-voted")
|
||||
end
|
||||
|
||||
within(".against") do
|
||||
expect(page).to have_css("a.no-voted")
|
||||
expect(page).to_not have_css("a.voted")
|
||||
end
|
||||
end
|
||||
|
||||
within("#debate_#{debate2.id}_votes") do
|
||||
within(".in-favor") do
|
||||
expect(page).to_not have_css("a.voted")
|
||||
expect(page).to_not have_css("a.no-voted")
|
||||
end
|
||||
|
||||
within(".against") do
|
||||
expect(page).to_not have_css("a.no-voted")
|
||||
expect(page).to_not have_css("a.voted")
|
||||
end
|
||||
end
|
||||
|
||||
within("#debate_#{debate3.id}_votes") do
|
||||
within(".in-favor") do
|
||||
expect(page).to have_css("a.no-voted")
|
||||
expect(page).to_not have_css("a.voted")
|
||||
end
|
||||
|
||||
within(".against") do
|
||||
expect(page).to have_css("a.voted")
|
||||
expect(page).to_not have_css("a.no-voted")
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
scenario 'Show no votes' do
|
||||
visit debate_path(@debate)
|
||||
|
||||
@@ -20,10 +67,14 @@ feature 'Votes' do
|
||||
|
||||
within('.in-favor') do
|
||||
expect(page).to have_content "0%"
|
||||
expect(page).to_not have_css("a.voted")
|
||||
expect(page).to_not have_css("a.no-voted")
|
||||
end
|
||||
|
||||
within('.against') do
|
||||
expect(page).to have_content "0%"
|
||||
expect(page).to_not have_css("a.voted")
|
||||
expect(page).to_not have_css("a.no-voted")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -37,10 +88,12 @@ feature 'Votes' do
|
||||
|
||||
within('.in-favor') do
|
||||
expect(page).to have_content "50%"
|
||||
expect(page).to have_css("a.voted")
|
||||
end
|
||||
|
||||
within('.against') do
|
||||
expect(page).to have_content "50%"
|
||||
expect(page).to have_css("a.no-voted")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user