Browse Source

lint

fix-remove-attr-accessors-from-questions-in-cldc-1723
Sam Seed 2 years ago
parent
commit
cacb18265a
  1. 2
      app/models/form/common/questions/created_by_id.rb
  2. 2
      app/models/form/common/questions/owning_organisation_id.rb
  3. 2
      app/models/form/lettings/questions/created_by_id.rb
  4. 2
      app/models/form/lettings/questions/managing_organisation.rb
  5. 2
      app/models/form/lettings/questions/stock_owner.rb
  6. 2
      app/models/form/question.rb
  7. 7
      spec/models/form/lettings/questions/managing_organisation_spec.rb

2
app/models/form/common/questions/created_by_id.rb

@ -24,7 +24,7 @@ class Form::Common::Questions::CreatedById < ::Form::Question
answer_options.select { |k, _v| user_ids.include?(k) } answer_options.select { |k, _v| user_ids.include?(k) }
end end
def label_from_value(value, log = nil, user = nil) def label_from_value(value, _log = nil, _user = nil)
return unless value return unless value
answer_options[value] answer_options[value]

2
app/models/form/common/questions/owning_organisation_id.rb

@ -21,7 +21,7 @@ class Form::Common::Questions::OwningOrganisationId < ::Form::Question
answer_options answer_options
end end
def label_from_value(value, log = nil, user = nil) def label_from_value(value, _log = nil, _user = nil)
return unless value return unless value
answer_options[value] answer_options[value]

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

@ -27,7 +27,7 @@ class Form::Lettings::Questions::CreatedById < ::Form::Question
answer_options.select { |k, _v| user_ids.include?(k) } answer_options.select { |k, _v| user_ids.include?(k) }
end end
def label_from_value(value, log = nil, user = nil) def label_from_value(value, _log = nil, _user = nil)
return unless value return unless value
answer_options[value] answer_options[value]

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

@ -18,7 +18,7 @@ class Form::Lettings::Questions::ManagingOrganisation < ::Form::Question
return opts unless log return opts unless log
if log.managing_organisation.present? if log.managing_organisation.present?
opts = opts.merge({ log.managing_organisation.id => log.managing_organisation.name} ) opts = opts.merge({ log.managing_organisation.id => log.managing_organisation.name })
end end
if current_user.support? if current_user.support?

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

@ -28,7 +28,7 @@ class Form::Lettings::Questions::StockOwner < ::Form::Question
answer_options answer_options
end end
def label_from_value(value, log = nil, user = nil) def label_from_value(value, _log = nil, _user = nil)
return unless value return unless value
answer_options[value] answer_options[value]

2
app/models/form/question.rb

@ -151,7 +151,7 @@ class Form::Question
end end
end end
def label_from_value(value, log = nil, user = nil) def label_from_value(value, _log = nil, _user = nil)
return unless value return unless value
label = case type label = case type

7
spec/models/form/lettings/questions/managing_organisation_spec.rb

@ -93,10 +93,10 @@ RSpec.describe Form::Lettings::Questions::ManagingOrganisation, type: :model do
end end
it "shows current managing agent at top, followed by the current owning organisation (with hint), followed by the managing agents of the current owning organisation" do it "shows current managing agent at top, followed by the current owning organisation (with hint), followed by the managing agents of the current owning organisation" do
log_owning_org.update(holds_own_stock: true) log_owning_org.update!(holds_own_stock: true)
expect(question.displayed_answer_options(log, user)).to eq(options) expect(question.displayed_answer_options(log, user)).to eq(options)
end end
end end
context "when org does not own stock" do context "when org does not own stock" do
let(:options) do let(:options) do
@ -109,7 +109,7 @@ RSpec.describe Form::Lettings::Questions::ManagingOrganisation, type: :model do
end end
it "shows current managing agent at top, followed by the managing agents of the current owning organisation" do it "shows current managing agent at top, followed by the managing agents of the current owning organisation" do
log_owning_org.update(holds_own_stock: false) log_owning_org.update!(holds_own_stock: false)
expect(question.displayed_answer_options(log, user)).to eq(options) expect(question.displayed_answer_options(log, user)).to eq(options)
end end
end end
@ -135,7 +135,6 @@ RSpec.describe Form::Lettings::Questions::ManagingOrganisation, type: :model do
expect(question.displayed_answer_options(log, user)).to eq(options) expect(question.displayed_answer_options(log, user)).to eq(options)
end end
end end
end end
it "is marked as derived" do it "is marked as derived" do

Loading…
Cancel
Save