Browse Source

test: wip tests

pull/1034/head
natdeanlewissoftwire 4 years ago
parent
commit
d801209896
  1. 44
      spec/features/schemes_helpers.rb
  2. 2
      spec/requests/locations_controller_spec.rb
  3. 2
      spec/requests/schemes_controller_spec.rb

44
spec/features/schemes_helpers.rb

@ -55,45 +55,17 @@ module SchemesHelpers
end
def fill_in_and_save_location
fill_in_and_save_postcode
fill_in_and_save_local_authority
fill_in_and_save_name
fill_in_and_save_units
fill_in_and_save_type_of_unit
fill_in_and_save_mobility_standards
fill_in_and_save_availability
end
def fill_in_and_save_postcode
fill_in with: "AA11AA"
click_button "Save and continue"
end
def fill_in_and_save_local_authority
fill_in with: "Adur"
end
def fill_in_and_save_name
fill_in with: "Some name"
click_button "Save and continue"
end
def fill_in_and_save_units
fill_in with: 5
click_button "Save and continue"
end
def fill_in_and_save_type_of_unit
choose "Self-contained house"
click_button "Save and continue"
end
def fill_in_and_save_mobility_standards
choose "location-mobility-type-none-field"
click_button "Save and continue"
end
def fill_in_and_save_availability
fill_in "Day", with: 2
fill_in "Month", with: 2
fill_in "Year", with: 2022
@ -101,13 +73,21 @@ module SchemesHelpers
end
def fill_in_and_save_second_location
fill_in "Postcode", with: "AA12AA"
fill_in "Location name (optional)", with: "Other name"
fill_in "Total number of units at this location", with: 2
fill_in with: "AA12AA"
click_button "Save and continue"
fill_in with: "Adur"
fill_in with: "Other name"
click_button "Save and continue"
fill_in with: 2
click_button "Save and continue"
choose "Self-contained house"
choose "location-add-another-location-no-field"
click_button "Save and continue"
choose "location-mobility-type-none-field"
click_button "Save and continue"
fill_in "Day", with: 2
fill_in "Month", with: 2
fill_in "Year", with: 2022
click_button "Save and continue"
end
def create_and_save_a_scheme

2
spec/requests/locations_controller_spec.rb

@ -42,6 +42,7 @@ RSpec.describe LocationsController, type: :request do
end
it "returns a template for a new location" do
follow_redirect!
expect(response).to have_http_status(:ok)
expect(page).to have_content("Add a location to this scheme")
end
@ -64,6 +65,7 @@ RSpec.describe LocationsController, type: :request do
end
it "returns a template for a new location" do
follow_redirect!
expect(response).to have_http_status(:ok)
expect(page).to have_content("Add a location to this scheme")
end

2
spec/requests/schemes_controller_spec.rb

@ -813,6 +813,7 @@ RSpec.describe SchemesController, type: :request do
let(:params) { { scheme: { intended_stay: "Medium stay", support_type: "Low level", page: "support" } } }
it "renders add location to this scheme successful update" do
follow_redirect!
follow_redirect!
expect(response).to have_http_status(:ok)
expect(page).to have_content("Add a location to this scheme")
@ -1096,6 +1097,7 @@ RSpec.describe SchemesController, type: :request do
let(:params) { { scheme: { intended_stay: "Medium stay", support_type: "Low level", page: "support" } } }
it "renders confirm secondary group after successful update" do
follow_redirect!
follow_redirect!
expect(response).to have_http_status(:ok)
expect(page).to have_content("Add a location to this scheme")

Loading…
Cancel
Save