|
|
|
@ -1177,7 +1177,7 @@ RSpec.describe SchemesController, type: :request do
|
|
|
|
|
|
|
|
|
|
context "when signed in as a data coordinator" do |
|
|
|
|
let(:user) { FactoryBot.create(:user, :data_coordinator) } |
|
|
|
|
let!(:scheme) { FactoryBot.create(:scheme, owning_organisation: user.organisation) } |
|
|
|
|
let!(:scheme) { FactoryBot.create(:scheme, owning_organisation: user.organisation, confirmed: nil) } |
|
|
|
|
let!(:another_scheme) { FactoryBot.create(:scheme) } |
|
|
|
|
|
|
|
|
|
before do |
|
|
|
@ -1204,7 +1204,7 @@ RSpec.describe SchemesController, type: :request do
|
|
|
|
|
|
|
|
|
|
context "when signed in as a support user" do |
|
|
|
|
let(:user) { FactoryBot.create(:user, :support) } |
|
|
|
|
let!(:scheme) { FactoryBot.create(:scheme) } |
|
|
|
|
let!(:scheme) { FactoryBot.create(:scheme, confirmed: nil) } |
|
|
|
|
|
|
|
|
|
before do |
|
|
|
|
allow(user).to receive(:need_two_factor_authentication?).and_return(false) |
|
|
|
@ -1216,6 +1216,21 @@ RSpec.describe SchemesController, type: :request do
|
|
|
|
|
expect(response).to have_http_status(:ok) |
|
|
|
|
expect(page).to have_content("What client group is this scheme intended for?") |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context "and the scheme is confirmed" do |
|
|
|
|
before do |
|
|
|
|
scheme.update!(confirmed: true) |
|
|
|
|
get "/schemes/#{scheme.id}/primary-client-group" |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "redirects to a view scheme page" do |
|
|
|
|
follow_redirect! |
|
|
|
|
expect(response).to have_http_status(:ok) |
|
|
|
|
expect(path).to match("/schemes/#{scheme.id}") |
|
|
|
|
expect(page).to have_content(scheme.service_name) |
|
|
|
|
assert_select "a", text: /Change/, count: 3 |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
@ -1243,7 +1258,7 @@ RSpec.describe SchemesController, type: :request do
|
|
|
|
|
|
|
|
|
|
context "when signed in as a data coordinator" do |
|
|
|
|
let(:user) { FactoryBot.create(:user, :data_coordinator) } |
|
|
|
|
let!(:scheme) { FactoryBot.create(:scheme, owning_organisation: user.organisation) } |
|
|
|
|
let!(:scheme) { FactoryBot.create(:scheme, owning_organisation: user.organisation, confirmed: nil) } |
|
|
|
|
let!(:another_scheme) { FactoryBot.create(:scheme) } |
|
|
|
|
|
|
|
|
|
before do |
|
|
|
@ -1270,7 +1285,7 @@ RSpec.describe SchemesController, type: :request do
|
|
|
|
|
|
|
|
|
|
context "when signed in as a support user" do |
|
|
|
|
let(:user) { FactoryBot.create(:user, :support) } |
|
|
|
|
let!(:scheme) { FactoryBot.create(:scheme) } |
|
|
|
|
let!(:scheme) { FactoryBot.create(:scheme, confirmed: nil) } |
|
|
|
|
|
|
|
|
|
before do |
|
|
|
|
allow(user).to receive(:need_two_factor_authentication?).and_return(false) |
|
|
|
@ -1282,6 +1297,21 @@ RSpec.describe SchemesController, type: :request do
|
|
|
|
|
expect(response).to have_http_status(:ok) |
|
|
|
|
expect(page).to have_content("Does this scheme provide for another client group?") |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context "and the scheme is confirmed" do |
|
|
|
|
before do |
|
|
|
|
scheme.update!(confirmed: true) |
|
|
|
|
get "/schemes/#{scheme.id}/confirm-secondary-client-group" |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "redirects to a view scheme page" do |
|
|
|
|
follow_redirect! |
|
|
|
|
expect(response).to have_http_status(:ok) |
|
|
|
|
expect(path).to match("/schemes/#{scheme.id}") |
|
|
|
|
expect(page).to have_content(scheme.service_name) |
|
|
|
|
assert_select "a", text: /Change/, count: 3 |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
@ -1309,7 +1339,7 @@ RSpec.describe SchemesController, type: :request do
|
|
|
|
|
|
|
|
|
|
context "when signed in as a data coordinator" do |
|
|
|
|
let(:user) { FactoryBot.create(:user, :data_coordinator) } |
|
|
|
|
let!(:scheme) { FactoryBot.create(:scheme, owning_organisation: user.organisation) } |
|
|
|
|
let!(:scheme) { FactoryBot.create(:scheme, owning_organisation: user.organisation, confirmed: nil) } |
|
|
|
|
let!(:another_scheme) { FactoryBot.create(:scheme) } |
|
|
|
|
|
|
|
|
|
before do |
|
|
|
@ -1336,7 +1366,7 @@ RSpec.describe SchemesController, type: :request do
|
|
|
|
|
|
|
|
|
|
context "when signed in as a support user" do |
|
|
|
|
let(:user) { FactoryBot.create(:user, :support) } |
|
|
|
|
let!(:scheme) { FactoryBot.create(:scheme) } |
|
|
|
|
let!(:scheme) { FactoryBot.create(:scheme, confirmed: nil) } |
|
|
|
|
|
|
|
|
|
before do |
|
|
|
|
allow(user).to receive(:need_two_factor_authentication?).and_return(false) |
|
|
|
@ -1348,6 +1378,21 @@ RSpec.describe SchemesController, type: :request do
|
|
|
|
|
expect(response).to have_http_status(:ok) |
|
|
|
|
expect(page).to have_content("What is the other client group?") |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context "and the scheme is confirmed" do |
|
|
|
|
before do |
|
|
|
|
scheme.update!(confirmed: true) |
|
|
|
|
get "/schemes/#{scheme.id}/secondary-client-group" |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "redirects to a view scheme page" do |
|
|
|
|
follow_redirect! |
|
|
|
|
expect(response).to have_http_status(:ok) |
|
|
|
|
expect(path).to match("/schemes/#{scheme.id}") |
|
|
|
|
expect(page).to have_content(scheme.service_name) |
|
|
|
|
assert_select "a", text: /Change/, count: 3 |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
@ -1375,7 +1420,7 @@ RSpec.describe SchemesController, type: :request do
|
|
|
|
|
|
|
|
|
|
context "when signed in as a data coordinator" do |
|
|
|
|
let(:user) { FactoryBot.create(:user, :data_coordinator) } |
|
|
|
|
let!(:scheme) { FactoryBot.create(:scheme, owning_organisation: user.organisation) } |
|
|
|
|
let!(:scheme) { FactoryBot.create(:scheme, owning_organisation: user.organisation, confirmed: nil) } |
|
|
|
|
let!(:another_scheme) { FactoryBot.create(:scheme) } |
|
|
|
|
|
|
|
|
|
before do |
|
|
|
@ -1398,11 +1443,26 @@ RSpec.describe SchemesController, type: :request do
|
|
|
|
|
expect(response).to have_http_status(:not_found) |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context "and the scheme is confirmed" do |
|
|
|
|
before do |
|
|
|
|
scheme.update!(confirmed: true) |
|
|
|
|
get "/schemes/#{scheme.id}/support" |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "redirects to a view scheme page" do |
|
|
|
|
follow_redirect! |
|
|
|
|
expect(response).to have_http_status(:ok) |
|
|
|
|
expect(path).to match("/schemes/#{scheme.id}") |
|
|
|
|
expect(page).to have_content(scheme.service_name) |
|
|
|
|
assert_select "a", text: /Change/, count: 2 |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context "when signed in as a support user" do |
|
|
|
|
let(:user) { FactoryBot.create(:user, :support) } |
|
|
|
|
let!(:scheme) { FactoryBot.create(:scheme) } |
|
|
|
|
let!(:scheme) { FactoryBot.create(:scheme, confirmed: nil) } |
|
|
|
|
|
|
|
|
|
before do |
|
|
|
|
allow(user).to receive(:need_two_factor_authentication?).and_return(false) |
|
|
|
@ -1507,7 +1567,7 @@ RSpec.describe SchemesController, type: :request do
|
|
|
|
|
|
|
|
|
|
context "when signed in as a data coordinator" do |
|
|
|
|
let(:user) { FactoryBot.create(:user, :data_coordinator) } |
|
|
|
|
let!(:scheme) { FactoryBot.create(:scheme, owning_organisation: user.organisation) } |
|
|
|
|
let!(:scheme) { FactoryBot.create(:scheme, owning_organisation: user.organisation, confirmed: nil) } |
|
|
|
|
let!(:another_scheme) { FactoryBot.create(:scheme) } |
|
|
|
|
|
|
|
|
|
before do |
|
|
|
@ -1530,11 +1590,26 @@ RSpec.describe SchemesController, type: :request do
|
|
|
|
|
expect(response).to have_http_status(:not_found) |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context "and the scheme is confirmed" do |
|
|
|
|
before do |
|
|
|
|
scheme.update!(confirmed: true) |
|
|
|
|
get "/schemes/#{scheme.id}/details" |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "redirects to a view scheme page" do |
|
|
|
|
follow_redirect! |
|
|
|
|
expect(response).to have_http_status(:ok) |
|
|
|
|
expect(path).to match("/schemes/#{scheme.id}") |
|
|
|
|
expect(page).to have_content(scheme.service_name) |
|
|
|
|
assert_select "a", text: /Change/, count: 2 |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context "when signed in as a support user" do |
|
|
|
|
let(:user) { FactoryBot.create(:user, :support) } |
|
|
|
|
let!(:scheme) { FactoryBot.create(:scheme) } |
|
|
|
|
let!(:scheme) { FactoryBot.create(:scheme, confirmed: nil) } |
|
|
|
|
|
|
|
|
|
before do |
|
|
|
|
allow(user).to receive(:need_two_factor_authentication?).and_return(false) |
|
|
|
|