Browse Source

testing confirm secondary group update with YES NO and returning from check answers page

pull/671/head
JG 3 years ago
parent
commit
146db3ad4b
  1. 50
      spec/requests/schemes_controller_spec.rb

50
spec/requests/schemes_controller_spec.rb

@ -660,6 +660,56 @@ RSpec.describe SchemesController, type: :request do
end
end
end
context "when updating confirm secondary client group" do
let(:params) { { scheme: { has_other_client_group: "Yes", page: "confirm-secondary" } } }
before do
sign_in user
patch "/schemes/#{scheme_to_update.id}", params:
end
it "renders secondary client group after successful update" do
follow_redirect!
expect(response).to have_http_status(:ok)
expect(page).to have_content("What is the other client group?")
end
it "updates a scheme with valid params" do
follow_redirect!
expect(scheme_to_update.reload.has_other_client_group).to eq("Yes")
end
context "when updating from check answers page with the answer YES" do
let(:params) { { scheme: { has_other_client_group: "Yes", page: "confirm-secondary", check_answers: "true" } } }
it "renders check answers page after successful update" do
follow_redirect!
expect(response).to have_http_status(:ok)
expect(page).to have_content("What is the other client group?")
end
it "updates a scheme with valid params" do
follow_redirect!
expect(scheme_to_update.reload.has_other_client_group).to eq("Yes")
end
end
context "when updating from check answers page with the answer NO" do
let(:params) { { scheme: { has_other_client_group: "No", page: "confirm-secondary", check_answers: "true" } } }
it "renders check answers page after successful update" do
follow_redirect!
expect(response).to have_http_status(:ok)
expect(page).to have_content("Check your changes before updating this scheme")
end
it "updates a scheme with valid params" do
follow_redirect!
expect(scheme_to_update.reload.has_other_client_group).to eq("No")
end
end
end
end
end
end

Loading…
Cancel
Save