|
|
|
@ -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 |
|
|
|
|