Browse Source

update tests

pull/784/head
Kat 3 years ago
parent
commit
414bbb3c41
  1. 7
      spec/features/schemes_spec.rb
  2. 7
      spec/requests/schemes_controller_spec.rb

7
spec/features/schemes_spec.rb

@ -120,10 +120,11 @@ RSpec.describe "Schemes scheme Features" do
end end
it "returns results with no location" do it "returns results with no location" do
scheme_to_search.locations.each { |location| location.destroy } scheme_without_location = FactoryBot.create(:scheme)
scheme_to_search.reload visit "/schemes"
fill_in("search", with: scheme_without_location.id_to_display)
click_button("Search") click_button("Search")
expect(page).to have_content(scheme_to_search.id_to_display) expect(page).to have_content(scheme_without_location.id_to_display)
end end
it "allows clearing the search results" do it "allows clearing the search results" do

7
spec/requests/schemes_controller_spec.rb

@ -180,10 +180,9 @@ RSpec.describe SchemesController, type: :request do
end end
it "returns results with no location" do it "returns results with no location" do
searched_scheme.locations.each { |location| location.destroy } scheme_without_location = FactoryBot.create(:scheme)
searched_scheme.reload get "/schemes?search=#{scheme_without_location.id}"
get "/schemes?search=#{search_param}" expect(page).to have_content(scheme_without_location.id_to_display)
expect(page).to have_content(searched_scheme.id_to_display)
schemes.each do |scheme| schemes.each do |scheme|
expect(page).not_to have_content(scheme.id_to_display) expect(page).not_to have_content(scheme.id_to_display)
end end

Loading…
Cancel
Save