Browse Source

feat: add depends on behaviour

CLDC-1750-po-fixes
natdeanlewissoftwire 2 years ago
parent
commit
a58fecb557
  1. 7
      app/models/form/sales/pages/mortgage_length.rb
  2. 4
      spec/models/form/sales/pages/mortgage_length_spec.rb

7
app/models/form/sales/pages/mortgage_length.rb

@ -1,4 +1,11 @@
class Form::Sales::Pages::MortgageLength < ::Form::Page
def initialize(id, hsh, subsection)
super
@depends_on = [{
"mortgageused" => 1,
}]
end
def questions
@questions ||= [
Form::Sales::Questions::MortgageLength.new(nil, nil, self),

4
spec/models/form/sales/pages/mortgage_length_spec.rb

@ -28,6 +28,8 @@ RSpec.describe Form::Sales::Pages::MortgageLength, type: :model do
end
it "has correct depends_on" do
expect(page.depends_on).to be_nil
expect(page.depends_on).to eq([{
"mortgageused" => 1,
}])
end
end

Loading…
Cancel
Save