Browse Source

Rubocop fixes

pull/705/head
Stéphane Meny 3 years ago
parent
commit
1fae60c76a
No known key found for this signature in database
GPG Key ID: 9D0AFEA988527923
  1. 6
      app/models/derived_variables/case_log_variables.rb
  2. 6
      spec/models/case_log_spec.rb

6
app/models/derived_variables/case_log_variables.rb

@ -69,10 +69,8 @@ module DerivedVariables::CaseLogVariables
self.new_old = new_or_existing_tenant self.new_old = new_or_existing_tenant
self.vacdays = property_vacant_days self.vacdays = property_vacant_days
if is_supported_housing? if is_supported_housing? && (scheme && scheme.locations.size == 1)
if scheme && scheme.locations.size == 1 self.location = scheme.locations.first
self.location = scheme.locations.first
end
end end
end end

6
spec/models/case_log_spec.rb

@ -1681,9 +1681,11 @@ RSpec.describe CaseLog do
context "when a case log is a supported housing log" do context "when a case log is a supported housing log" do
before { case_log.needstype = 2 } before { case_log.needstype = 2 }
context "and a scheme with a single log is selected" do context "and a scheme with a single log is selected" do
let(:scheme) { FactoryBot.create(:scheme) } let(:scheme) { FactoryBot.create(:scheme) }
let!(:location) { FactoryBot.create(:location, scheme:)} let!(:location) { FactoryBot.create(:location, scheme:) }
before { case_log.update!(scheme:) } before { case_log.update!(scheme:) }
it "derives the scheme location" do it "derives the scheme location" do
@ -2162,6 +2164,4 @@ RSpec.describe CaseLog do
end end
end end
end end
end end

Loading…
Cancel
Save