diff --git a/spec/shared/system/mappable.rb b/spec/shared/system/mappable.rb index b1551a47a..68d1edde4 100644 --- a/spec/shared/system/mappable.rb +++ b/spec/shared/system/mappable.rb @@ -175,12 +175,14 @@ shared_examples "mappable" do |mappable_factory_name, mappable_association_name, describe "At #{mappable_edit_path}", if: mappable_edit_path.present? do scenario "Should edit map on #{mappable_factory_name} and contain default values" do + mappable.map_location.update!(latitude: 51.48, longitude: 0.0) do_login_for mappable.author, management: management visit send(mappable_edit_path, id: mappable.id) expect(page).to have_content "Navigate the map to the location and place the marker." - validate_latitude_longitude(mappable, mappable_factory_name) + expect(page).to have_field "#{mappable_factory_name}_map_location_attributes_latitude", type: :hidden, with: "51.48" + expect(page).to have_field "#{mappable_factory_name}_map_location_attributes_longitude", type: :hidden, with: "0.0" end scenario "Should edit default values from map on #{mappable_factory_name} edit page" do diff --git a/spec/shared/system/nested_documentable.rb b/spec/shared/system/nested_documentable.rb index dafc01796..08225a442 100644 --- a/spec/shared/system/nested_documentable.rb +++ b/spec/shared/system/nested_documentable.rb @@ -210,6 +210,8 @@ shared_examples "nested documentable" do |login_as_name, documentable_factory_na documentable_attach_new_file(file_fixture("empty.pdf")) click_on submit_button + expect(page).to have_content documentable_success_notice + documentable_redirected_to_resource_show_or_navigate_to expect(page).to have_content "Documents" @@ -232,6 +234,9 @@ shared_examples "nested documentable" do |login_as_name, documentable_factory_na end click_on submit_button + + expect(page).to have_content documentable_success_notice + documentable_redirected_to_resource_show_or_navigate_to expect(page).to have_content "Documents (#{documentable.class.max_documents_allowed})" diff --git a/spec/shared/system/nested_imageable.rb b/spec/shared/system/nested_imageable.rb index 1d6d1899e..f82b66abb 100644 --- a/spec/shared/system/nested_imageable.rb +++ b/spec/shared/system/nested_imageable.rb @@ -184,6 +184,9 @@ shared_examples "nested imageable" do |imageable_factory_name, path, imageable_p expect(page).to have_selector ".loading-bar.complete" click_on submit_button + + expect(page).to have_content imageable_success_notice + imageable_redirected_to_resource_show_or_navigate_to(imageable) expect(page).to have_selector "figure img" diff --git a/spec/support/common_actions/maps.rb b/spec/support/common_actions/maps.rb index 28be79eb1..1cc8ce233 100644 --- a/spec/support/common_actions/maps.rb +++ b/spec/support/common_actions/maps.rb @@ -13,15 +13,6 @@ module Maps end end - def validate_latitude_longitude(mappable, mappable_factory_name) - latitude_attribute = "##{mappable_factory_name}_map_location_attributes_latitude" - longitude_attribute = "##{mappable_factory_name}_map_location_attributes_longitude" - expect(find(latitude_attribute, visible: false).value).to eq "51.48" - expect(find(longitude_attribute, visible: false).value).to eq "0.0" - expect(mappable.map_location.latitude).to eq 51.48 - expect(mappable.map_location.longitude).to eq 0.0 - end - def fill_in_budget_investment_form fill_in_new_investment_title with: "Budget investment title" fill_in_ckeditor "Description", with: "Budget investment description" diff --git a/spec/system/admin/poll/booths_spec.rb b/spec/system/admin/poll/booths_spec.rb index eb6cead7e..a930bf9f6 100644 --- a/spec/system/admin/poll/booths_spec.rb +++ b/spec/system/admin/poll/booths_spec.rb @@ -13,7 +13,7 @@ describe "Admin booths", :admin do end scenario "Index" do - 3.times { create(:poll_booth) } + booths = 3.times.map { create(:poll_booth) } visit admin_root_path @@ -22,7 +22,6 @@ describe "Admin booths", :admin do click_link "Booths location" end - booths = Poll::Booth.all booths.each do |booth| within("#booth_#{booth.id}") do expect(page).to have_content booth.name diff --git a/spec/system/admin/poll/polls_spec.rb b/spec/system/admin/poll/polls_spec.rb index dc3b090aa..a677ca0cc 100644 --- a/spec/system/admin/poll/polls_spec.rb +++ b/spec/system/admin/poll/polls_spec.rb @@ -21,13 +21,6 @@ describe "Admin polls", :admin do expect(page).to have_content "List of polls" expect(page).to have_css ".poll", count: 3 - polls = Poll.all - polls.each do |poll| - within("#poll_#{poll.id}") do - expect(page).to have_content poll.name - end - end - expect(poll_3.name).to appear_before(poll_1.name) expect(poll_1.name).to appear_before(poll_2.name) expect(page).not_to have_content "There are no polls" @@ -219,6 +212,7 @@ describe "Admin polls", :admin do booth.booth_assignments.each do |booth_assignment| 3.times { create(:poll_officer_assignment, booth_assignment: booth_assignment) } end + officers = Poll::Officer.all visit admin_poll_path(poll) @@ -226,7 +220,6 @@ describe "Admin polls", :admin do expect(page).to have_css ".officer", count: 3 - officers = Poll::Officer.all officers.each do |officer| within("#officer_#{officer.id}") do expect(page).to have_content officer.name diff --git a/spec/system/moderation/users_spec.rb b/spec/system/moderation/users_spec.rb index cf712de18..ce9eed9ec 100644 --- a/spec/system/moderation/users_spec.rb +++ b/spec/system/moderation/users_spec.rb @@ -38,7 +38,9 @@ describe "Moderate users" do expect(page).not_to have_content(comment3.body) - click_link("Sign out") + click_link "Sign out" + + expect(page).to have_content "You have been signed out successfully" visit root_path