Browse Source

lint

pull/767/head
Kat 3 years ago
parent
commit
179a1a55bf
  1. 2
      spec/features/schemes_helpers.rb
  2. 18
      spec/features/schemes_spec.rb

2
spec/features/schemes_helpers.rb

@ -28,7 +28,7 @@ module SchemesHelpers
check "This scheme contains confidential information" check "This scheme contains confidential information"
choose "Direct access hostel" choose "Direct access hostel"
choose "Yes – registered care home providing nursing care" choose "Yes – registered care home providing nursing care"
select organisation.name, from: "scheme-owning-organisation-id-field" select organisation_name, from: "scheme-owning-organisation-id-field"
choose answers["housing_stock_owners"].presence || "The same organisation that owns the housing stock" choose answers["housing_stock_owners"].presence || "The same organisation that owns the housing stock"
click_button "Save and continue" click_button "Save and continue"
end end

18
spec/features/schemes_spec.rb

@ -208,10 +208,11 @@ RSpec.describe "Schemes scheme Features" do
end end
context "when creating a new scheme" do context "when creating a new scheme" do
let!(:organisation) { FactoryBot.create(:organisation, name: "FooBar") } let(:organisation_name) { "FooBar" }
let(:scheme) { Scheme.first } let(:scheme) { Scheme.first }
before do before do
FactoryBot.create(:organisation, name: organisation_name)
Scheme.destroy_all Scheme.destroy_all
click_link "Schemes", href: "/schemes" click_link "Schemes", href: "/schemes"
end end
@ -222,8 +223,6 @@ RSpec.describe "Schemes scheme Features" do
end end
context "when I press create a new scheme" do context "when I press create a new scheme" do
let!(:organisation) { FactoryBot.create(:organisation, name: "FooBar") }
before do before do
click_link "Create a new supported housing scheme" click_link "Create a new supported housing scheme"
end end
@ -470,13 +469,12 @@ RSpec.describe "Schemes scheme Features" do
end end
end end
context "when I fill in scheme details indicating that supported services provided by a different organisation and I press save I see primary client group section" do context "when I fill in scheme details indicating that supported services provided by a different organisation and I press save I see primary client group section" do
let(:scheme) { Scheme.first } let(:scheme) { Scheme.first }
let!(:another_organisation) { FactoryBot.create(:organisation, name: "Another Org") } let!(:another_organisation) { FactoryBot.create(:organisation, name: "Another Org") }
before do before do
fill_in_and_save_scheme_details({"housing_stock_owners" => "Another registered housing provider"}) fill_in_and_save_scheme_details({ "housing_stock_owners" => "Another registered housing provider" })
end end
it "lets me fill in the managing organisation details" do it "lets me fill in the managing organisation details" do
@ -515,22 +513,22 @@ RSpec.describe "Schemes scheme Features" do
fill_in_and_save_support fill_in_and_save_support
fill_in_and_save_location fill_in_and_save_location
end end
it "displays change links" do it "displays change links" do
assert_selector "a", text: "Change", count: 13 assert_selector "a", text: "Change", count: 13
end end
it "allows changing details questions" do it "allows changing details questions" do
click_link("Change", href: "/schemes/#{scheme.id}/details?check_answers=true", match: :first) click_link("Change", href: "/schemes/#{scheme.id}/details?check_answers=true", match: :first)
expect(page).to have_current_path("/schemes/#{scheme.id}/details?check_answers=true") expect(page).to have_current_path("/schemes/#{scheme.id}/details?check_answers=true")
fill_in "Scheme name", with: "Example" fill_in "Scheme name", with: "Example"
click_button "Save and continue" click_button "Save and continue"
expect(page).to have_current_path("/schemes/#{scheme.id}/check-answers") expect(page).to have_current_path("/schemes/#{scheme.id}/check-answers")
expect(page).to have_content "Example" expect(page).to have_content "Example"
end end
it "lets me select the support answers after navigating back" do it "lets me select the support answers after navigating back" do
click_link("Change", href: "/schemes/#{scheme.id}/details?check_answers=true", match: :first) click_link("Change", href: "/schemes/#{scheme.id}/details?check_answers=true", match: :first)
click_link "Back" click_link "Back"

Loading…
Cancel
Save