fix organization_owner? method

pull/15580/head
Gonzalo Riestra 5 years ago
parent caceb199a3
commit 853afc7264

@ -144,7 +144,7 @@ module Carto::UserCommons
alias_method :has_organization?, :organization_user?
def organization_owner?
organization&.owner_id == id
organization_user? && organization.owner_id == id
end
def organization_admin?

@ -20,4 +20,4 @@ describe 'refactored behaviour' do
FactoryGirl.build(:valid_user)
end
end
end
end

@ -1150,4 +1150,14 @@ shared_examples_for "user models" do
expect(@user.show_trial_reminder?).to be_false
end
end
describe '#organization_owner?' do
it 'returns false if the user does not have organization nor id' do
user = build_user
user.organization = nil
user.id = nil
expect(user.organization_owner?).to be_false
end
end
end

Loading…
Cancel
Save