|
|
|
@ -1164,7 +1164,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 |
|
|
|
@ -1191,7 +1191,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) |
|
|
|
@ -1203,6 +1203,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 |
|
|
|
|
|
|
|
|
@ -1230,7 +1245,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 |
|
|
|
@ -1257,7 +1272,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) |
|
|
|
@ -1269,6 +1284,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 |
|
|
|
|
|
|
|
|
@ -1296,7 +1326,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 |
|
|
|
@ -1323,7 +1353,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) |
|
|
|
@ -1335,6 +1365,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 |
|
|
|
|
|
|
|
|
@ -1362,7 +1407,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 |
|
|
|
@ -1385,11 +1430,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) |
|
|
|
@ -1538,7 +1598,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 |
|
|
|
@ -1561,11 +1621,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) |
|
|
|
|