@ -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)
@ -1150,4 +1150,14 @@ shared_examples_for "user models" do
expect(@user.show_trial_reminder?).to be_false
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