Browse Source

testing primary client group update via regular path

pull/671/head
JG 3 years ago
parent
commit
a9ae2c275a
  1. 22
      spec/requests/schemes_controller_spec.rb

22
spec/requests/schemes_controller_spec.rb

@ -621,5 +621,27 @@ RSpec.describe SchemesController, type: :request do
expect(response).to have_http_status(:unauthorized) expect(response).to have_http_status(:unauthorized)
end end
end end
context "when signed in as a data coordinator" do
let(:user) { FactoryBot.create(:user, :data_coordinator) }
let(:scheme_to_update) { FactoryBot.create(:scheme, :organisation => user.organisation) }
let(:params) { { scheme: { primary_client_group: "Homeless families with support needs", page: "primary-client-group" } } }
before do
sign_in user
patch "/schemes/#{scheme_to_update.id}", params:
end
it "renders the primary client group after successful update" do
follow_redirect!
expect(response).to have_http_status(:ok)
expect(page).to have_content("Does this scheme provide for another client group?")
end
it "updates a scheme with valid params" do
follow_redirect!
expect(scheme_to_update.reload.primary_client_group).to eq("Homeless families with support needs")
end
end
end end
end end

Loading…
Cancel
Save