Browse Source

Create relevant tests

pull/1039/head
Kat 4 years ago
parent
commit
af73f4bff4
  1. 11
      spec/requests/organisations_controller_spec.rb
  2. 11
      spec/requests/schemes_controller_spec.rb

11
spec/requests/organisations_controller_spec.rb

@ -123,6 +123,17 @@ RSpec.describe OrganisationsController, type: :request do
end
end
it "shows incomplete schemes at the top" do
schemes[0].update!(confirmed: nil, owning_organisation: user.organisation)
schemes[2].update!(confirmed: false, owning_organisation: user.organisation)
schemes[4].update!(confirmed: false, owning_organisation: user.organisation)
get "/organisations/#{organisation.id}/schemes", headers:, params: {}
expect(page.all(".govuk-tag")[1].text).to eq("Incomplete")
expect(page.all(".govuk-tag")[2].text).to eq("Incomplete")
expect(page.all(".govuk-tag")[3].text).to eq("Incomplete")
end
context "with schemes that are not in scope for the user, i.e. that they do not belong to" do
let!(:unauthorised_organisation) { FactoryBot.create(:organisation) }

11
spec/requests/schemes_controller_spec.rb

@ -66,6 +66,17 @@ RSpec.describe SchemesController, type: :request do
assert_select ".govuk-tag", text: /Incomplete/, count: 1
end
it "shows incomplete schemes at the top" do
schemes[0].update!(confirmed: nil)
schemes[2].update!(confirmed: false)
schemes[4].update!(confirmed: false)
get "/schemes"
expect(page.all(".govuk-tag")[1].text).to eq("Incomplete")
expect(page.all(".govuk-tag")[2].text).to eq("Incomplete")
expect(page.all(".govuk-tag")[3].text).to eq("Incomplete")
end
it "displays a link to check answers page if the scheme is incomplete" do
scheme = schemes[0]
scheme.update!(confirmed: nil)

Loading…
Cancel
Save