Browse Source

Always show ManagingOrganisation

CLDC-20-more-ac-fixes3
Jack S 2 years ago
parent
commit
d9939ade8c
  1. 6
      app/models/form/lettings/questions/managing_organisation.rb
  2. 31
      spec/models/form/lettings/questions/managing_organisation_spec.rb

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

@ -47,11 +47,7 @@ class Form::Lettings::Questions::ManagingOrganisation < ::Form::Question
def hidden_in_check_answers?(_log, user = nil)
@current_user = user
return false unless @current_user
return false if @current_user.support?
managing_organisations_answer_options.count < 2
@current_user.nil?
end
def enabled

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

@ -142,34 +142,19 @@ RSpec.describe Form::Lettings::Questions::ManagingOrganisation, type: :model do
end
describe "#hidden_in_check_answers?" do
context "when housing providers < 2" do
context "when not support user" do
let(:user) { create(:user) }
it "is hidden in check answers" do
expect(question.hidden_in_check_answers?(nil, user)).to be true
end
end
context "when support" do
let(:user) { create(:user, :support) }
context "when user present" do
let(:user) { create(:user) }
it "is not hiddes in check answers" do
expect(question.hidden_in_check_answers?(nil, user)).to be false
end
it "is hidden in check answers" do
expect(question.hidden_in_check_answers?(nil, user)).to be false
end
end
context "when managing agents >= 2" do
let(:user) { create(:user) }
before do
create(:organisation_relationship, :managing, parent_organisation: user.organisation)
create(:organisation_relationship, :managing, parent_organisation: user.organisation)
end
context "when user not provided" do
let(:user) { create(:user, :support) }
it "is not hidden in check answers" do
expect(question.hidden_in_check_answers?(nil, user)).to be false
it "is not hiddes in check answers" do
expect(question.hidden_in_check_answers?(nil)).to be true
end
end
end

Loading…
Cancel
Save