Browse Source

All cops pass

pull/266/head
baarkerlounger 3 years ago
parent
commit
8205ee6213
  1. 4
      .rubocop.yml
  2. 3
      spec/features/form/page_routing_spec.rb
  3. 11
      spec/requests/form_controller_spec.rb

4
.rubocop.yml

@ -1,13 +1,13 @@
require: require:
- rubocop-performance - rubocop-performance
- rubocop-rails - rubocop-rails
# - rubocop-rspec - rubocop-rspec
inherit_gem: inherit_gem:
rubocop-govuk: rubocop-govuk:
- config/default.yml - config/default.yml
- config/rails.yml - config/rails.yml
# - config/rspec.yml - config/rspec.yml
AllCops: AllCops:
Exclude: Exclude:

3
spec/features/form/page_routing_spec.rb

@ -14,10 +14,11 @@ RSpec.describe "Form Page Routing" do
) )
end end
let(:id) { case_log.id } let(:id) { case_log.id }
let(:validator) { case_log._validators[nil].first }
before do before do
RequestHelper.stub_http_requests RequestHelper.stub_http_requests
allow_any_instance_of(CaseLogValidator).to receive(:validate_pregnancy).and_return(true) allow(validator).to receive(:validate_pregnancy).and_return(true)
sign_in user sign_in user
end end

11
spec/requests/form_controller_spec.rb

@ -245,10 +245,7 @@ RSpec.describe FormController, type: :request do
end end
context "with conditional routing" do context "with conditional routing" do
before do let(:validator) { case_log._validators[nil].first }
allow_any_instance_of(CaseLogValidator).to receive(:validate_pregnancy).and_return(true)
end
let(:case_log_form_conditional_question_yes_params) do let(:case_log_form_conditional_question_yes_params) do
{ {
id: case_log.id, id: case_log.id,
@ -258,7 +255,6 @@ RSpec.describe FormController, type: :request do
}, },
} }
end end
let(:case_log_form_conditional_question_no_params) do let(:case_log_form_conditional_question_no_params) do
{ {
id: case_log.id, id: case_log.id,
@ -268,7 +264,6 @@ RSpec.describe FormController, type: :request do
}, },
} }
end end
let(:case_log_form_conditional_question_wchair_yes_params) do let(:case_log_form_conditional_question_wchair_yes_params) do
{ {
id: case_log.id, id: case_log.id,
@ -279,6 +274,10 @@ RSpec.describe FormController, type: :request do
} }
end end
before do
allow(validator).to receive(:validate_pregnancy).and_return(true)
end
it "routes to the appropriate conditional page based on the question answer of the current page" do it "routes to the appropriate conditional page based on the question answer of the current page" do
post "/logs/#{case_log.id}/form", params: case_log_form_conditional_question_yes_params post "/logs/#{case_log.id}/form", params: case_log_form_conditional_question_yes_params
expect(response).to redirect_to("/logs/#{case_log.id}/conditional-question-yes-page") expect(response).to redirect_to("/logs/#{case_log.id}/conditional-question-yes-page")

Loading…
Cancel
Save