|
|
@ -123,12 +123,13 @@ RSpec.describe OrganisationsController, type: :request do |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it "shows schemes in alpabetical order" do |
|
|
|
it "shows schemes in alphabetical order" do |
|
|
|
schemes[0].update!(service_name: "aaa", owning_organisation: user.organisation) |
|
|
|
schemes[0].update!(service_name: "aaa", owning_organisation: user.organisation) |
|
|
|
schemes[1].update!(service_name: "daa", owning_organisation: user.organisation) |
|
|
|
schemes[1].update!(service_name: "daa", owning_organisation: user.organisation) |
|
|
|
schemes[2].update!(service_name: "baa", owning_organisation: user.organisation) |
|
|
|
schemes[2].update!(service_name: "baa", owning_organisation: user.organisation) |
|
|
|
schemes[3].update!(service_name: "Faa", owning_organisation: user.organisation) |
|
|
|
schemes[3].update!(service_name: "Faa", owning_organisation: user.organisation) |
|
|
|
schemes[4].update!(service_name: "Caa", owning_organisation: user.organisation) |
|
|
|
schemes[4].update!(service_name: "Caa", owning_organisation: user.organisation) |
|
|
|
|
|
|
|
same_org_scheme.update!(service_name: "zzz", owning_organisation: user.organisation) |
|
|
|
get "/organisations/#{organisation.id}/schemes", headers:, params: {} |
|
|
|
get "/organisations/#{organisation.id}/schemes", headers:, params: {} |
|
|
|
all_links = page.all(".govuk-link") |
|
|
|
all_links = page.all(".govuk-link") |
|
|
|
scheme_links = all_links.select { |link| link[:href] =~ %r{^/schemes/\d+$} } |
|
|
|
scheme_links = all_links.select { |link| link[:href] =~ %r{^/schemes/\d+$} } |
|
|
@ -138,6 +139,7 @@ RSpec.describe OrganisationsController, type: :request do |
|
|
|
expect(scheme_links[2][:href]).to eq("/schemes/#{schemes[4].id}") |
|
|
|
expect(scheme_links[2][:href]).to eq("/schemes/#{schemes[4].id}") |
|
|
|
expect(scheme_links[3][:href]).to eq("/schemes/#{schemes[1].id}") |
|
|
|
expect(scheme_links[3][:href]).to eq("/schemes/#{schemes[1].id}") |
|
|
|
expect(scheme_links[4][:href]).to eq("/schemes/#{schemes[3].id}") |
|
|
|
expect(scheme_links[4][:href]).to eq("/schemes/#{schemes[3].id}") |
|
|
|
|
|
|
|
expect(scheme_links[5][:href]).to eq("/schemes/#{same_org_scheme.id}") |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
context "with schemes that are not in scope for the user, i.e. that they do not belong to" do |
|
|
|
context "with schemes that are not in scope for the user, i.e. that they do not belong to" do |
|
|
|