Use JavaScript in tests opening modal dialogs
This way we reproduce the user experience in the tests, and we can make sure modal dialogs open when we expect it.
This commit is contained in:
@@ -772,33 +772,31 @@ describe "Debates" do
|
||||
end
|
||||
end
|
||||
|
||||
scenario "Mark/Unmark a debate as featured", :admin do
|
||||
scenario "Mark/Unmark a debate as featured", :admin, :js do
|
||||
debate = create(:debate)
|
||||
|
||||
visit debates_path
|
||||
within("#debates") do
|
||||
expect(page).not_to have_content "Featured"
|
||||
expect(page).not_to have_content "FEATURED"
|
||||
end
|
||||
|
||||
click_link debate.title
|
||||
|
||||
click_link "Featured"
|
||||
|
||||
visit debates_path
|
||||
accept_confirm { click_link "Featured" }
|
||||
|
||||
within("#debates") do
|
||||
expect(page).to have_content "Featured"
|
||||
expect(page).to have_content "FEATURED"
|
||||
end
|
||||
|
||||
within("#featured-debates") do
|
||||
expect(page).to have_content debate.title
|
||||
|
||||
click_link debate.title
|
||||
end
|
||||
|
||||
visit debate_path(debate)
|
||||
click_link "Unmark featured"
|
||||
accept_confirm { click_link "Unmark featured" }
|
||||
|
||||
within("#debates") do
|
||||
expect(page).not_to have_content "Featured"
|
||||
expect(page).not_to have_content "FEATURED"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user