Browse Source

CLDC-3684 Extract lettings tenancy information copy (#2731)

* Extract lettings tenancy information copy

* Fix flaky merged schemes test
pull/2717/head^2
kosiakkatrina 2 months ago committed by GitHub
parent
commit
f2f44329f3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 1
      app/models/form/lettings/pages/starter_tenancy_type.rb
  2. 1
      app/models/form/lettings/pages/tenancy_length.rb
  3. 1
      app/models/form/lettings/pages/tenancy_length_affordable_rent.rb
  4. 1
      app/models/form/lettings/pages/tenancy_length_intermediate_rent.rb
  5. 1
      app/models/form/lettings/pages/tenancy_length_periodic.rb
  6. 1
      app/models/form/lettings/pages/tenancy_type.rb
  7. 3
      app/models/form/lettings/questions/joint.rb
  8. 3
      app/models/form/lettings/questions/sheltered.rb
  9. 4
      app/models/form/lettings/questions/starter_tenancy_type.rb
  10. 11
      app/models/form/lettings/questions/startertenancy.rb
  11. 4
      app/models/form/lettings/questions/tenancy_length.rb
  12. 11
      app/models/form/lettings/questions/tenancy_length_affordable_rent.rb
  13. 11
      app/models/form/lettings/questions/tenancy_length_intermediate_rent.rb
  14. 4
      app/models/form/lettings/questions/tenancy_length_periodic.rb
  15. 4
      app/models/form/lettings/questions/tenancy_other.rb
  16. 4
      app/models/form/lettings/questions/tenancy_type.rb
  17. 66
      config/locales/forms/2023/lettings/tenancy_information.en.yml
  18. 66
      config/locales/forms/2024/lettings/tenancy_information.en.yml
  19. 2
      spec/models/form/lettings/questions/starter_tenancy_type_spec.rb
  20. 2
      spec/models/form/lettings/questions/tenancy_length_affordable_rent_spec.rb
  21. 2
      spec/models/form/lettings/questions/tenancy_length_intermediate_rent_spec.rb
  22. 2
      spec/models/form/lettings/questions/tenancy_length_periodic_spec.rb
  23. 2
      spec/models/form/lettings/questions/tenancy_length_spec.rb
  24. 2
      spec/models/form/lettings/questions/tenancy_other_spec.rb
  25. 2
      spec/models/form/lettings/questions/tenancy_type_spec.rb
  26. 6
      spec/services/merge/merge_organisations_service_spec.rb

1
app/models/form/lettings/pages/starter_tenancy_type.rb

@ -2,6 +2,7 @@ class Form::Lettings::Pages::StarterTenancyType < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "starter_tenancy_type"
@copy_key = "lettings.tenancy_information.tenancy.starter_tenancy_type"
@depends_on = [{ "starter_tenancy?" => true }]
end

1
app/models/form/lettings/pages/tenancy_length.rb

@ -2,6 +2,7 @@ class Form::Lettings::Pages::TenancyLength < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "tenancy_length"
@copy_key = "lettings.tenancy_information.tenancylength.tenancy_length"
@depends_on = [{ "tenancy_type_fixed_term?" => true, "needstype" => 2 }]
end

1
app/models/form/lettings/pages/tenancy_length_affordable_rent.rb

@ -2,6 +2,7 @@ class Form::Lettings::Pages::TenancyLengthAffordableRent < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "tenancy_length_affordable_rent"
@copy_key = "lettings.tenancy_information.tenancylength.tenancy_length_affordable_rent"
@depends_on = [{ "tenancy_type_fixed_term?" => true, "affordable_or_social_rent?" => true, "needstype" => 1 }]
end

1
app/models/form/lettings/pages/tenancy_length_intermediate_rent.rb

@ -2,6 +2,7 @@ class Form::Lettings::Pages::TenancyLengthIntermediateRent < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "tenancy_length_intermediate_rent"
@copy_key = "lettings.tenancy_information.tenancylength.tenancy_length_intermediate_rent"
@depends_on = [{ "tenancy_type_fixed_term?" => true, "affordable_or_social_rent?" => false, "needstype" => 1 }]
end

1
app/models/form/lettings/pages/tenancy_length_periodic.rb

@ -2,6 +2,7 @@ class Form::Lettings::Pages::TenancyLengthPeriodic < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "tenancy_length_periodic"
@copy_key = "lettings.tenancy_information.tenancylength.tenancy_length_periodic"
@depends_on = [{ "tenancy_type_periodic?" => true }]
end

1
app/models/form/lettings/pages/tenancy_type.rb

@ -2,6 +2,7 @@ class Form::Lettings::Pages::TenancyType < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "tenancy_type"
@copy_key = "lettings.tenancy_information.tenancy.tenancy_type"
@depends_on = [{ "starter_tenancy?" => false }]
end

3
app/models/form/lettings/questions/joint.rb

@ -2,11 +2,8 @@ class Form::Lettings::Questions::Joint < ::Form::Question
def initialize(id, hsh, page)
super
@id = "joint"
@check_answer_label = "Is this a joint tenancy?"
@header = "Is this a joint tenancy?"
@type = "radio"
@check_answers_card_number = 0
@hint_text = form.start_year_after_2024? ? "This is where two or more people are named on the tenancy agreement" : ""
@answer_options = ANSWER_OPTIONS
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
end

3
app/models/form/lettings/questions/sheltered.rb

@ -2,11 +2,8 @@ class Form::Lettings::Questions::Sheltered < ::Form::Question
def initialize(id, hsh, page)
super
@id = "sheltered"
@check_answer_label = "Is this letting in sheltered accommodation?"
@header = "Is this letting in sheltered accommodation?"
@type = "radio"
@check_answers_card_number = 0
@hint_text = "Sheltered housing and special retirement housing are for tenants with low-level care and support needs. This typically provides some limited support to enable independent living, such as alarm-based assistance or a scheme manager.</br></br>Extra care housing is for tenants with medium to high care and support needs, often with 24 hour access to support staff provided by an agency registered with the Care Quality Commission."
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
end

4
app/models/form/lettings/questions/starter_tenancy_type.rb

@ -2,11 +2,9 @@ class Form::Lettings::Questions::StarterTenancyType < ::Form::Question
def initialize(id, hsh, page)
super
@id = "tenancy"
@check_answer_label = form.start_year_after_2024? ? "Type of main tenancy after the starter or introductory period has ended" : "Type of main tenancy after the starter period has ended"
@header = form.start_year_after_2024? ? "What is the type of tenancy after the starter or introductory period has ended?" : "What is the type of tenancy after the starter period has ended?"
@copy_key = "lettings.tenancy_information.tenancy.#{page.id}.tenancy"
@type = "radio"
@check_answers_card_number = 0
@hint_text = form.start_year_after_2024? ? "" : "This is also known as an ‘introductory period’."
@conditional_for = { "tenancyother" => [3] }
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
end

11
app/models/form/lettings/questions/startertenancy.rb

@ -2,8 +2,6 @@ class Form::Lettings::Questions::Startertenancy < ::Form::Question
def initialize(id, hsh, page)
super
@id = "startertenancy"
@check_answer_label = "Is this a starter or introductory tenancy?"
@header = "Is this a starter tenancy?"
@type = "radio"
@check_answers_card_number = 0
@answer_options = ANSWER_OPTIONS
@ -12,14 +10,5 @@ class Form::Lettings::Questions::Startertenancy < ::Form::Question
ANSWER_OPTIONS = { "1" => { "value" => "Yes" }, "2" => { "value" => "No" } }.freeze
def hint_text
if form.start_year_after_2024?
"If the tenancy has an ‘introductory period’ answer ‘yes’.<br><br>
You should submit a CORE log at the beginning of the starter tenancy or introductory period, with the best information you have at the time. You do not need to submit a log when a tenant later rolls onto the main tenancy."
else
"This is also known as an ‘introductory period’."
end
end
QUESTION_NUMBER_FROM_YEAR = { 2023 => 26 }.freeze
end

4
app/models/form/lettings/questions/tenancy_length.rb

@ -2,14 +2,12 @@ class Form::Lettings::Questions::TenancyLength < ::Form::Question
def initialize(id, hsh, page)
super
@id = "tenancylength"
@check_answer_label = "Length of fixed-term tenancy"
@header = "What is the length of the fixed-term tenancy to the nearest year?"
@copy_key = "lettings.tenancy_information.tenancylength.#{page.id}"
@type = "numeric"
@width = 2
@check_answers_card_number = 0
@max = 150
@min = 0
@hint_text = "Do not include the starter or introductory period."
@step = 1
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
end

11
app/models/form/lettings/questions/tenancy_length_affordable_rent.rb

@ -2,8 +2,7 @@ class Form::Lettings::Questions::TenancyLengthAffordableRent < ::Form::Question
def initialize(id, hsh, page)
super
@id = "tenancylength"
@check_answer_label = "Length of fixed-term tenancy"
@header = "What is the length of the fixed-term tenancy to the nearest year?"
@copy_key = "lettings.tenancy_information.tenancylength.#{page.id}"
@type = "numeric"
@width = 2
@check_answers_card_number = 0
@ -13,13 +12,5 @@ class Form::Lettings::Questions::TenancyLengthAffordableRent < ::Form::Question
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
end
def hint_text
if form.start_year_after_2024?
"Do not include the starter or introductory period.</br>The minimum period is 2 years for social or affordable rent general needs logs. You do not need to submit CORE logs for these types of tenancies if they are shorter than 2 years."
else
"Do not include the starter or introductory period.</br>The minimum period is 2 years for social or affordable rent general needs logs and you do not need a log for shorter tenancies."
end
end
QUESTION_NUMBER_FROM_YEAR = { 2023 => 28 }.freeze
end

11
app/models/form/lettings/questions/tenancy_length_intermediate_rent.rb

@ -2,8 +2,7 @@ class Form::Lettings::Questions::TenancyLengthIntermediateRent < ::Form::Questio
def initialize(id, hsh, page)
super
@id = "tenancylength"
@check_answer_label = "Length of fixed-term tenancy"
@header = "What is the length of the fixed-term tenancy to the nearest year?"
@copy_key = "lettings.tenancy_information.tenancylength.#{page.id}"
@type = "numeric"
@width = 2
@check_answers_card_number = 0
@ -13,13 +12,5 @@ class Form::Lettings::Questions::TenancyLengthIntermediateRent < ::Form::Questio
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
end
def hint_text
if form.start_year_after_2024?
"Do not include the starter or introductory period.</br>The minimum period is 1 year for intermediate rent general needs logs. You do not need to submit CORE logs for these types of tenancies if they are shorter than 1 year."
else
"Do not include the starter or introductory period.</br>The minimum period is 1 year for intermediate rent general needs logs and you do not need a log for shorter tenancies."
end
end
QUESTION_NUMBER_FROM_YEAR = { 2023 => 28 }.freeze
end

4
app/models/form/lettings/questions/tenancy_length_periodic.rb

@ -2,8 +2,7 @@ class Form::Lettings::Questions::TenancyLengthPeriodic < ::Form::Question
def initialize(id, hsh, page)
super
@id = "tenancylength"
@check_answer_label = "Length of periodic tenancy"
@header = "What is the length of the periodic tenancy to the nearest year?"
@copy_key = "lettings.tenancy_information.tenancylength.#{page.id}"
@type = "numeric"
@width = 2
@check_answers_card_number = 0
@ -11,7 +10,6 @@ class Form::Lettings::Questions::TenancyLengthPeriodic < ::Form::Question
@min = 0
@step = 1
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
@hint_text = "As this is a periodic tenancy, this question is optional. If you do not have the information available click save and continue"
end
QUESTION_NUMBER_FROM_YEAR = { 2023 => 28 }.freeze

4
app/models/form/lettings/questions/tenancy_other.rb

@ -2,11 +2,9 @@ class Form::Lettings::Questions::TenancyOther < ::Form::Question
def initialize(id, hsh, page)
super
@id = "tenancyother"
@check_answer_label = ""
@header = "Please state the tenancy type"
@copy_key = "lettings.tenancy_information.tenancy.#{page.id}.tenancyother"
@type = "text"
@check_answers_card_number = 0
@hint_text = ""
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
end

4
app/models/form/lettings/questions/tenancy_type.rb

@ -2,11 +2,9 @@ class Form::Lettings::Questions::TenancyType < ::Form::Question
def initialize(id, hsh, page)
super
@id = "tenancy"
@check_answer_label = "Type of main tenancy"
@header = "What is the type of tenancy?"
@copy_key = "lettings.tenancy_information.tenancy.#{page.id}.tenancy"
@type = "radio"
@check_answers_card_number = 0
@hint_text = ""
@conditional_for = { "tenancyother" => [3] }
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max]
end

66
config/locales/forms/2023/lettings/tenancy_information.en.yml

@ -0,0 +1,66 @@
en:
forms:
2023:
lettings:
tenancy_information:
joint:
page_header: ""
check_answer_label: "Is this a joint tenancy?"
hint_text: ""
question_text: "Is this a joint tenancy?"
startertenancy:
page_header: ""
check_answer_label: "Is this a starter or introductory tenancy?"
hint_text: "This is also known as an ‘introductory period’."
question_text: "Is this a starter tenancy?"
tenancy:
tenancy_type:
page_header: ""
tenancy:
check_answer_label: "Type of main tenancy"
hint_text: ""
question_text: "What is the type of tenancy?"
tenancyother:
check_answer_label: ""
hint_text: ""
question_text: "Please state the tenancy type"
starter_tenancy_type:
page_header: ""
tenancy:
check_answer_label: "Type of main tenancy after the starter period has ended"
hint_text: "This is also known as an ‘introductory period’."
question_text: "What is the type of tenancy after the starter period has ended?"
tenancyother:
check_answer_label: ""
hint_text: ""
question_text: "Please state the tenancy type"
tenancylength:
tenancy_length:
page_header: ""
check_answer_label: "Length of fixed-term tenancy"
hint_text: "Do not include the starter or introductory period."
question_text: "What is the length of the fixed-term tenancy to the nearest year?"
tenancy_length_affordable_rent:
page_header: ""
check_answer_label: "Length of fixed-term tenancy"
hint_text: "Do not include the starter or introductory period.</br>The minimum period is 2 years for social or affordable rent general needs logs and you do not need a log for shorter tenancies."
question_text: "What is the length of the fixed-term tenancy to the nearest year?"
tenancy_length_intermediate_rent:
page_header: ""
check_answer_label: "Length of fixed-term tenancy"
hint_text: "Do not include the starter or introductory period.</br>The minimum period is 1 year for intermediate rent general needs logs and you do not need a log for shorter tenancies."
question_text: "What is the length of the fixed-term tenancy to the nearest year?"
tenancy_length_periodic:
page_header: ""
check_answer_label: "Length of periodic tenancy"
hint_text: "As this is a periodic tenancy, this question is optional. If you do not have the information available click save and continue"
question_text: "What is the length of the periodic tenancy to the nearest year?"
sheltered:
page_header: ""
check_answer_label: "Is this letting in sheltered accommodation?"
hint_text: "Sheltered housing and special retirement housing are for tenants with low-level care and support needs. This typically provides some limited support to enable independent living, such as alarm-based assistance or a scheme manager.</br></br>Extra care housing is for tenants with medium to high care and support needs, often with 24 hour access to support staff provided by an agency registered with the Care Quality Commission."
question_text: "Is this letting in sheltered accommodation?"

66
config/locales/forms/2024/lettings/tenancy_information.en.yml

@ -0,0 +1,66 @@
en:
forms:
2024:
lettings:
tenancy_information:
joint:
page_header: ""
check_answer_label: "Is this a joint tenancy?"
hint_text: "This is where two or more people are named on the tenancy agreement"
question_text: "Is this a joint tenancy?"
startertenancy:
page_header: ""
check_answer_label: "Is this a starter or introductory tenancy?"
hint_text: "If the tenancy has an ‘introductory period’ answer ‘yes’.<br><br>You should submit a CORE log at the beginning of the starter tenancy or introductory period, with the best information you have at the time. You do not need to submit a log when a tenant later rolls onto the main tenancy."
question_text: "Is this a starter tenancy?"
tenancy:
tenancy_type:
page_header: ""
tenancy:
check_answer_label: "Type of main tenancy"
hint_text: ""
question_text: "What is the type of tenancy?"
tenancyother:
check_answer_label: ""
hint_text: ""
question_text: "Please state the tenancy type"
starter_tenancy_type:
page_header: ""
tenancy:
check_answer_label: "Type of main tenancy after the starter or introductory period has ended"
hint_text: ""
question_text: "What is the type of tenancy after the starter or introductory period has ended?"
tenancyother:
check_answer_label: ""
hint_text: ""
question_text: "Please state the tenancy type"
tenancylength:
tenancy_length:
page_header: ""
check_answer_label: "Length of fixed-term tenancy"
hint_text: "Do not include the starter or introductory period."
question_text: "What is the length of the fixed-term tenancy to the nearest year?"
tenancy_length_affordable_rent:
page_header: ""
check_answer_label: "Length of fixed-term tenancy"
hint_text: "Do not include the starter or introductory period.</br>The minimum period is 2 years for social or affordable rent general needs logs. You do not need to submit CORE logs for these types of tenancies if they are shorter than 2 years."
question_text: "What is the length of the fixed-term tenancy to the nearest year?"
tenancy_length_intermediate_rent:
page_header: ""
check_answer_label: "Length of fixed-term tenancy"
hint_text: "Do not include the starter or introductory period.</br>The minimum period is 1 year for intermediate rent general needs logs. You do not need to submit CORE logs for these types of tenancies if they are shorter than 1 year."
question_text: "What is the length of the fixed-term tenancy to the nearest year?"
tenancy_length_periodic:
page_header: ""
check_answer_label: "Length of periodic tenancy"
hint_text: "As this is a periodic tenancy, this question is optional. If you do not have the information available click save and continue"
question_text: "What is the length of the periodic tenancy to the nearest year?"
sheltered:
page_header: ""
check_answer_label: "Is this letting in sheltered accommodation?"
hint_text: "Sheltered housing and special retirement housing are for tenants with low-level care and support needs. This typically provides some limited support to enable independent living, such as alarm-based assistance or a scheme manager.</br></br>Extra care housing is for tenants with medium to high care and support needs, often with 24 hour access to support staff provided by an agency registered with the Care Quality Commission."
question_text: "Is this letting in sheltered accommodation?"

2
spec/models/form/lettings/questions/starter_tenancy_type_spec.rb

@ -5,7 +5,7 @@ RSpec.describe Form::Lettings::Questions::StarterTenancyType, type: :model do
let(:question_id) { nil }
let(:question_definition) { nil }
let(:page) { instance_double(Form::Page) }
let(:page) { instance_double(Form::Page, id: "starter_tenancy_type") }
let(:subsection) { instance_double(Form::Subsection) }
let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1)) }

2
spec/models/form/lettings/questions/tenancy_length_affordable_rent_spec.rb

@ -5,7 +5,7 @@ RSpec.describe Form::Lettings::Questions::TenancyLengthAffordableRent, type: :mo
let(:question_id) { nil }
let(:question_definition) { nil }
let(:page) { instance_double(Form::Page) }
let(:page) { instance_double(Form::Page, id: "affordable_tenancy_length") }
let(:subsection) { instance_double(Form::Subsection) }
let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1)) }

2
spec/models/form/lettings/questions/tenancy_length_intermediate_rent_spec.rb

@ -5,7 +5,7 @@ RSpec.describe Form::Lettings::Questions::TenancyLengthIntermediateRent, type: :
let(:question_id) { nil }
let(:question_definition) { nil }
let(:page) { instance_double(Form::Page) }
let(:page) { instance_double(Form::Page, id: "intermediate_tenancy_length") }
let(:subsection) { instance_double(Form::Subsection) }
let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1)) }

2
spec/models/form/lettings/questions/tenancy_length_periodic_spec.rb

@ -5,7 +5,7 @@ RSpec.describe Form::Lettings::Questions::TenancyLengthPeriodic, type: :model do
let(:question_id) { nil }
let(:question_definition) { nil }
let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1)))) }
let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1))), id: "periodic_tenancy_length") }
it "has correct page" do
expect(question.page).to eq(page)

2
spec/models/form/lettings/questions/tenancy_length_spec.rb

@ -3,7 +3,7 @@ require "rails_helper"
RSpec.describe Form::Lettings::Questions::TenancyLength, type: :model do
subject(:question) { described_class.new(nil, nil, page) }
let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1)))) }
let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1))), id: "tenancy_length") }
it "has correct page" do
expect(question.page).to eq(page)

2
spec/models/form/lettings/questions/tenancy_other_spec.rb

@ -3,7 +3,7 @@ require "rails_helper"
RSpec.describe Form::Lettings::Questions::TenancyOther, type: :model do
subject(:question) { described_class.new(nil, nil, page) }
let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1)))) }
let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1))), id: "tenancy_type") }
it "has correct page" do
expect(question.page).to eq(page)

2
spec/models/form/lettings/questions/tenancy_type_spec.rb

@ -3,7 +3,7 @@ require "rails_helper"
RSpec.describe Form::Lettings::Questions::TenancyType, type: :model do
subject(:question) { described_class.new(nil, nil, page) }
let(:page) { instance_double(Form::Page) }
let(:page) { instance_double(Form::Page, id: "tenancy_type") }
let(:subsection) { instance_double(Form::Subsection) }
let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1)) }

6
spec/services/merge/merge_organisations_service_spec.rb

@ -1317,9 +1317,9 @@ RSpec.describe Merge::MergeOrganisationsService do
merging_organisation.reload
expect(new_absorbing_organisation.owned_lettings_logs.count).to eq(2)
expect(new_absorbing_organisation.managed_lettings_logs.count).to eq(1)
expect(new_absorbing_organisation.owned_lettings_logs.find(owned_lettings_log.id).scheme).to eq(new_absorbing_organisation.owned_schemes.first)
expect(new_absorbing_organisation.owned_lettings_logs.find(owned_lettings_log.id).location).to eq(new_absorbing_organisation.owned_schemes.first.locations.first)
expect(new_absorbing_organisation.owned_lettings_logs.find(owned_lettings_log_no_location.id).scheme).to eq(new_absorbing_organisation.owned_schemes.first)
expect(new_absorbing_organisation.owned_lettings_logs.find(owned_lettings_log.id).scheme).to eq(new_absorbing_organisation.owned_schemes.find_by(service_name: scheme.service_name))
expect(new_absorbing_organisation.owned_lettings_logs.find(owned_lettings_log.id).location).to eq(new_absorbing_organisation.owned_schemes.find_by(service_name: scheme.service_name).locations.first)
expect(new_absorbing_organisation.owned_lettings_logs.find(owned_lettings_log_no_location.id).scheme).to eq(new_absorbing_organisation.owned_schemes.find_by(service_name: scheme.service_name))
expect(new_absorbing_organisation.owned_lettings_logs.find(owned_lettings_log_no_location.id).location).to eq(nil)
end

Loading…
Cancel
Save