Skip to content
This repository has been archived by the owner on Dec 28, 2023. It is now read-only.

Commit

Permalink
Add admin ability to create punch
Browse files Browse the repository at this point in the history
  • Loading branch information
Douglas Lutz committed Mar 6, 2020
1 parent b6cc8aa commit e19b49f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/models/ability.rb
Expand Up @@ -35,6 +35,7 @@ def admin_permitions(user)
else
can :manage, ACTIONS, company_id: user.company_id
can :read, Punch, company_id: user.company_id
can :manage, Punch, user_id: user.id
can :create, ACTIONS
end

Expand Down
4 changes: 4 additions & 0 deletions spec/models/ability_spec.rb
Expand Up @@ -10,6 +10,10 @@
describe 'abilities admin' do
let(:ability_admin) { Ability.new(admin_user) }

it "can manage it's own punches" do
expect(ability_admin).to be_able_to :manage, Punch.new(user: admin_user)
end

it "can't delete Company" do
expect(ability_admin).to_not be_able_to :destroy, Company.new
end
Expand Down

0 comments on commit e19b49f

Please sign in to comment.