From 751e8b5f1c4324d591fb3d1734f978dabb137b01 Mon Sep 17 00:00:00 2001 From: baarkerlounger Date: Thu, 6 Jan 2022 18:23:44 +0000 Subject: [PATCH] Don't introduce heisenspecs --- spec/views/form/page_view_spec.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/spec/views/form/page_view_spec.rb b/spec/views/form/page_view_spec.rb index edb7061df..0950c9d1e 100644 --- a/spec/views/form/page_view_spec.rb +++ b/spec/views/form/page_view_spec.rb @@ -11,6 +11,7 @@ RSpec.describe "form/page" do let(:subsection) { form.get_subsection("income_and_benefits") } let(:page) { form.get_page("net_income") } let(:question) { page.questions.find { |q| q.id == "earnings" } } + let(:initial_attribs) { { type: "numeric", answer_options: nil } } def assign_attributes(object, attrs) attrs.each_pair do |attr, value| @@ -20,6 +21,7 @@ RSpec.describe "form/page" do context "given a question with extra guidance" do let(:expected_guidance) { /What counts as income?/ } + before do assign(:case_log, case_log) assign(:page, page) @@ -28,6 +30,10 @@ RSpec.describe "form/page" do render end + after do + assign_attributes(question, initial_attribs) + end + context "with radio type" do let(:attribs) { { type: "radio", answer_options: { "1": "A", "2": "B" } } } it "renders the guidance partial for radio questions" do