Browse Source

Update prefers not to say value

pull/2193/head
Kat 2 years ago
parent
commit
d2eee4b24c
  1. 2
      app/models/form/lettings/questions/nationality_all_group.rb
  2. 2
      app/models/form/sales/questions/nationality_all_group.rb
  3. 2
      app/models/log.rb
  4. 2
      app/models/sales_log.rb
  5. 2
      spec/models/lettings_log_spec.rb
  6. 4
      spec/models/sales_log_spec.rb

2
app/models/form/lettings/questions/nationality_all_group.rb

@ -16,6 +16,6 @@ class Form::Lettings::Questions::NationalityAllGroup < ::Form::Question
ANSWER_OPTIONS = {
"826" => { "value" => "United Kingdom" },
"12" => { "value" => "Other" },
"13" => { "value" => "Tenant prefers not to say" },
"0" => { "value" => "Tenant prefers not to say" },
}.freeze
end

2
app/models/form/sales/questions/nationality_all_group.rb

@ -15,6 +15,6 @@ class Form::Sales::Questions::NationalityAllGroup < ::Form::Question
ANSWER_OPTIONS = {
"826" => { "value" => "United Kingdom" },
"12" => { "value" => "Other" },
"13" => { "value" => "Buyer prefers not to say" },
"0" => { "value" => "Buyer prefers not to say" },
}.freeze
end

2
app/models/log.rb

@ -210,7 +210,7 @@ class Log < ApplicationRecord
end
def nationality_uk_or_prefers_not_to_say?
nationality_all_group == 13 || nationality_all_group == 826
nationality_all_group == 0 || nationality_all_group == 826
end
private

2
app/models/sales_log.rb

@ -475,6 +475,6 @@ class SalesLog < Log
end
def nationality2_uk_or_prefers_not_to_say?
nationality_all_buyer2_group == 13 || nationality_all_buyer2_group == 826
nationality_all_buyer2_group == 0 || nationality_all_buyer2_group == 826
end
end

2
spec/models/lettings_log_spec.rb

@ -2359,7 +2359,7 @@ RSpec.describe LettingsLog do
end
it "correctly derives nationality_all when it's prefers not to say" do
expect { lettings_log.update!(nationality_all_group: 13, declaration: 1) }.to change(lettings_log, :nationality_all).to 13
expect { lettings_log.update!(nationality_all_group: 0, declaration: 1) }.to change(lettings_log, :nationality_all).to 0
end
it "does not derive nationality_all when it's other or not given" do

4
spec/models/sales_log_spec.rb

@ -585,8 +585,8 @@ RSpec.describe SalesLog, type: :model do
end
it "correctly derives nationality_all/nationality_all_buyer2 when buyer prefers not to say" do
expect { sales_log.update!(nationality_all_group: 13) }.to change(sales_log, :nationality_all).to 13
expect { sales_log.update!(nationality_all_buyer2_group: 13) }.to change(sales_log, :nationality_all_buyer2).to 13
expect { sales_log.update!(nationality_all_group: 0) }.to change(sales_log, :nationality_all).to 0
expect { sales_log.update!(nationality_all_buyer2_group: 0) }.to change(sales_log, :nationality_all_buyer2).to 0
end
it "does not derive nationality_all/nationality_all_buyer2 when it is other or not given" do

Loading…
Cancel
Save