You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
64 lines
1.9 KiB
64 lines
1.9 KiB
2 years ago
|
require "rails_helper"
|
||
|
|
||
11 months ago
|
RSpec.describe Form::Sales::Questions::Buyer1Nationality, type: :model do
|
||
2 years ago
|
subject(:question) { described_class.new(nil, nil, page) }
|
||
2 years ago
|
|
||
|
let(:page) { instance_double(Form::Page) }
|
||
|
|
||
|
it "has correct page" do
|
||
2 years ago
|
expect(question.page).to be page
|
||
2 years ago
|
end
|
||
|
|
||
|
it "has the correct id" do
|
||
2 years ago
|
expect(question.id).to eq "national"
|
||
2 years ago
|
end
|
||
|
|
||
|
it "has the correct header" do
|
||
2 years ago
|
expect(question.header).to eq "What is buyer 1’s nationality?"
|
||
2 years ago
|
end
|
||
|
|
||
|
it "has the correct check_answer_label" do
|
||
2 years ago
|
expect(question.check_answer_label).to eq "Buyer 1’s nationality"
|
||
2 years ago
|
end
|
||
|
|
||
|
it "has the correct type" do
|
||
2 years ago
|
expect(question.type).to eq "radio"
|
||
2 years ago
|
end
|
||
|
|
||
|
it "is not marked as derived" do
|
||
|
expect(question.derived?).to be false
|
||
|
end
|
||
|
|
||
|
it "has the correct hint" do
|
||
2 years ago
|
expect(question.hint_text).to eq "Buyer 1 is the person in the household who does the most paid work. If it’s a joint purchase and the buyers do the same amount of paid work, buyer 1 is whoever is the oldest."
|
||
2 years ago
|
end
|
||
|
|
||
|
it "has the correct answer_options" do
|
||
|
expect(question.answer_options).to eq({
|
||
|
"18" => { "value" => "United Kingdom" },
|
||
|
"17" => { "value" => "Republic of Ireland" },
|
||
|
"19" => { "value" => "European Economic Area (EEA), excluding ROI" },
|
||
|
"12" => { "value" => "Other" },
|
||
|
"13" => { "value" => "Buyer prefers not to say" },
|
||
|
})
|
||
|
end
|
||
|
|
||
|
it "has correct conditional for" do
|
||
2 years ago
|
expect(question.conditional_for).to be_nil
|
||
2 years ago
|
end
|
||
|
|
||
|
it "has correct hidden in check answers" do
|
||
2 years ago
|
expect(question.hidden_in_check_answers).to be_nil
|
||
2 years ago
|
end
|
||
2 years ago
|
|
||
|
it "has the correct check_answers_card_number" do
|
||
2 years ago
|
expect(question.check_answers_card_number).to be 1
|
||
2 years ago
|
end
|
||
2 years ago
|
|
||
|
it "has the correct inferred_check_answers_value" do
|
||
|
expect(question.inferred_check_answers_value).to eq([
|
||
|
{ "condition" => { "national" => 13 }, "value" => "Prefers not to say" },
|
||
|
])
|
||
|
end
|
||
2 years ago
|
end
|