Browse Source

lint and fix url in tests

pull/1007/head
Kat 4 years ago
parent
commit
f38c02cc85
  1. 24
      app/helpers/toggle_active_location_helper.rb
  2. 3
      spec/features/schemes_spec.rb
  3. 4
      spec/requests/locations_controller_spec.rb

24
app/helpers/toggle_active_location_helper.rb

@ -1,17 +1,17 @@
module ToggleActiveLocationHelper module ToggleActiveLocationHelper
def toggle_location_form_path(action, scheme_id, location_id) def toggle_location_form_path(action, scheme_id, location_id)
if action == "deactivate" if action == "deactivate"
scheme_location_new_deactivation_path(scheme_id:, location_id:) scheme_location_new_deactivation_path(scheme_id:, location_id:)
else else
scheme_location_reactivate_path(scheme_id:, location_id:) scheme_location_reactivate_path(scheme_id:, location_id:)
end
end end
end
def date_type_question(action) def date_type_question(action)
action == "deactivate" ? :deactivation_date_type : :reactivation_date_type action == "deactivate" ? :deactivation_date_type : :reactivation_date_type
end end
def date_question(action) def date_question(action)
action == "deactivate" ? :deactivation_date : :reactivation_date action == "deactivate" ? :deactivation_date : :reactivation_date
end end
end end

3
spec/features/schemes_spec.rb

@ -754,7 +754,6 @@ RSpec.describe "Schemes scheme Features" do
expect(page).to have_current_path("/schemes/#{scheme.id}/locations") expect(page).to have_current_path("/schemes/#{scheme.id}/locations")
end end
context "when location is incative" do context "when location is incative" do
context "and I click to view the location" do context "and I click to view the location" do
before do before do
@ -792,8 +791,8 @@ RSpec.describe "Schemes scheme Features" do
expect(page).to have_current_path("/schemes/#{scheme.id}/locations") expect(page).to have_current_path("/schemes/#{scheme.id}/locations")
end end
end end
end
end end
end
context "when I click to change location name" do context "when I click to change location name" do
before do before do

4
spec/requests/locations_controller_spec.rb

@ -1428,7 +1428,7 @@ RSpec.describe LocationsController, type: :request do
it "renders reactivate this location" do it "renders reactivate this location" do
expect(response).to have_http_status(:ok) expect(response).to have_http_status(:ok)
expect(page).to have_link("Reactivate this location", href: "/schemes/#{scheme.id}/locations/#{location.id}/reactivate") expect(page).to have_link("Reactivate this location", href: "/schemes/#{scheme.id}/locations/#{location.id}/new-reactivation")
end end
end end
@ -1437,7 +1437,7 @@ RSpec.describe LocationsController, type: :request do
it "renders reactivate this location" do it "renders reactivate this location" do
expect(response).to have_http_status(:ok) expect(response).to have_http_status(:ok)
expect(page).to have_link("Reactivate this location", href: "/schemes/#{scheme.id}/locations/#{location.id}/reactivate") expect(page).to have_link("Reactivate this location", href: "/schemes/#{scheme.id}/locations/#{location.id}/new-reactivation")
end end
end end
end end

Loading…
Cancel
Save