Browse Source
* Set uprn_known to 1 when setting UPRN * Move fake to dev+test gemfile block So that we can use factories in local * Move UPRN known and UPRN questions to single UPRN pagepull/1554/head
Jack
2 years ago
committed by
GitHub
24 changed files with 97 additions and 179 deletions
@ -1,16 +0,0 @@
|
||||
class Form::Lettings::Pages::UprnKnown < ::Form::Page |
||||
def initialize(id, hsh, subsection) |
||||
super |
||||
@id = "uprn_known" |
||||
end |
||||
|
||||
def questions |
||||
@questions ||= [ |
||||
Form::Lettings::Questions::UprnKnown.new(nil, nil, self), |
||||
] |
||||
end |
||||
|
||||
def routed_to?(log, _current_user = nil) |
||||
!log.is_supported_housing? |
||||
end |
||||
end |
@ -1,12 +0,0 @@
|
||||
class Form::Sales::Pages::UprnKnown < ::Form::Page |
||||
def initialize(id, hsh, subsection) |
||||
super |
||||
@id = "uprn_known" |
||||
end |
||||
|
||||
def questions |
||||
@questions ||= [ |
||||
Form::Sales::Questions::UprnKnown.new(nil, nil, self), |
||||
] |
||||
end |
||||
end |
@ -1,51 +0,0 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Lettings::Pages::UprnKnown, type: :model do |
||||
subject(:page) { described_class.new(page_id, page_definition, subsection) } |
||||
|
||||
let(:page_id) { nil } |
||||
let(:page_definition) { nil } |
||||
let(:subsection) { instance_double(Form::Subsection) } |
||||
|
||||
it "has correct subsection" do |
||||
expect(page.subsection).to eq(subsection) |
||||
end |
||||
|
||||
it "has correct questions" do |
||||
expect(page.questions.map(&:id)).to eq(%w[uprn_known]) |
||||
end |
||||
|
||||
it "has the correct id" do |
||||
expect(page.id).to eq("uprn_known") |
||||
end |
||||
|
||||
it "has the correct header" do |
||||
expect(page.header).to be_nil |
||||
end |
||||
|
||||
it "has the correct description" do |
||||
expect(page.description).to be_nil |
||||
end |
||||
|
||||
it "has correct depends_on" do |
||||
expect(page.depends_on).to be_nil |
||||
end |
||||
|
||||
describe "has correct routed_to?" do |
||||
context "when needstype != 2" do |
||||
let(:log) { create(:lettings_log, needstype: nil) } |
||||
|
||||
it "returns true" do |
||||
expect(page.routed_to?(log)).to eq(true) |
||||
end |
||||
end |
||||
|
||||
context "when needstype == 2" do |
||||
let(:log) { create(:lettings_log, needstype: 2) } |
||||
|
||||
it "returns true" do |
||||
expect(page.routed_to?(log)).to eq(false) |
||||
end |
||||
end |
||||
end |
||||
end |
@ -1,33 +0,0 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Sales::Pages::UprnKnown, type: :model do |
||||
subject(:page) { described_class.new(page_id, page_definition, subsection) } |
||||
|
||||
let(:page_id) { nil } |
||||
let(:page_definition) { nil } |
||||
let(:subsection) { instance_double(Form::Subsection) } |
||||
|
||||
it "has correct subsection" do |
||||
expect(page.subsection).to eq(subsection) |
||||
end |
||||
|
||||
it "has correct questions" do |
||||
expect(page.questions.map(&:id)).to eq(%w[uprn_known]) |
||||
end |
||||
|
||||
it "has the correct id" do |
||||
expect(page.id).to eq("uprn_known") |
||||
end |
||||
|
||||
it "has the correct header" do |
||||
expect(page.header).to be_nil |
||||
end |
||||
|
||||
it "has the correct description" do |
||||
expect(page.description).to be_nil |
||||
end |
||||
|
||||
it "has correct depends_on" do |
||||
expect(page.depends_on).to be_nil |
||||
end |
||||
end |
Loading…
Reference in new issue