|
|
|
@ -42,4 +42,34 @@ RSpec.describe Form::Sales::Questions::AddressLine1, type: :model do
|
|
|
|
|
it "has the correct check_answers_card_number" do |
|
|
|
|
expect(question.check_answers_card_number).to be_nil |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
describe "has the correct get_extra_check_answer_value" do |
|
|
|
|
context "when la is not present" do |
|
|
|
|
let(:log) { create(:sales_log, la: nil) } |
|
|
|
|
|
|
|
|
|
it "returns nil" do |
|
|
|
|
expect(question.get_extra_check_answer_value(log)).to be_nil |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context "when la is present but not inferred" do |
|
|
|
|
let(:log) { create(:sales_log, la: "E09000003", is_la_inferred: false) } |
|
|
|
|
|
|
|
|
|
it "returns nil" do |
|
|
|
|
expect(question.get_extra_check_answer_value(log)).to be_nil |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context "when la is present but inferred" do |
|
|
|
|
let(:log) { create(:sales_log, la: "E09000003") } |
|
|
|
|
|
|
|
|
|
before do |
|
|
|
|
allow(log).to receive(:is_la_inferred?).and_return(true) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "returns the la" do |
|
|
|
|
expect(question.get_extra_check_answer_value(log)).to eq("Barnet") |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|