Unify votes specs

This commit is contained in:
taitus
2023-05-25 11:10:24 +02:00
parent d28ed1d17b
commit 7fd773773a

View File

@@ -74,9 +74,11 @@ describe "Votes" do
end
end
scenario "Update" do
scenario "Create and update from debate show" do
visit debate_path(create(:debate))
expect(page).to have_content "No votes"
click_button "I agree"
within(".in-favor") do
@@ -84,6 +86,13 @@ describe "Votes" do
expect(page).to have_button class: "voted"
end
within(".against") do
expect(page).to have_content "0%"
expect(page).to have_css("button.no-voted")
end
expect(page).to have_content "1 vote"
click_button "I disagree"
within(".in-favor") do
@@ -136,24 +145,6 @@ describe "Votes" do
end
end
scenario "Create from debate show" do
visit debate_path(create(:debate))
click_button "I agree"
within(".in-favor") do
expect(page).to have_content "100%"
expect(page).to have_button class: "voted"
end
within(".against") do
expect(page).to have_content "0%"
expect(page).to have_button class: "no-voted"
end
expect(page).to have_content "1 vote"
end
scenario "Create in index" do
create(:debate)
visit debates_path