mirror of
https://github.com/internetee/registry.git
synced 2025-07-05 10:43:32 +02:00
Refactor roles
This commit is contained in:
parent
b527221baf
commit
b0eb6798b0
16 changed files with 155 additions and 223 deletions
|
@ -1,3 +0,0 @@
|
|||
Fabricator(:role) do
|
||||
code 'admin'
|
||||
end
|
|
@ -4,5 +4,5 @@ Fabricator(:user) do
|
|||
email 'info@gitlab.eu'
|
||||
identity_code '37810013108'
|
||||
country
|
||||
role
|
||||
roles ['admin']
|
||||
end
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
require 'rails_helper'
|
||||
|
||||
describe Right do
|
||||
it { should have_and_belong_to_many(:roles) }
|
||||
end
|
|
@ -1,5 +0,0 @@
|
|||
require 'rails_helper'
|
||||
|
||||
describe Role do
|
||||
it { should have_and_belong_to_many(:rights) }
|
||||
end
|
|
@ -2,8 +2,6 @@ require 'rails_helper'
|
|||
require 'cancan/matchers'
|
||||
|
||||
describe User do
|
||||
it { should belong_to(:role) }
|
||||
|
||||
describe 'abilities' do
|
||||
subject(:ability) { Ability.new(user) }
|
||||
let(:user) { nil }
|
||||
|
@ -29,7 +27,7 @@ describe User do
|
|||
end
|
||||
|
||||
context 'when user is customer service' do
|
||||
let(:user) { Fabricate(:user, role: Role.new(code: 'customer_service')) }
|
||||
let(:user) { Fabricate(:user, roles: ['customer_service']) }
|
||||
|
||||
it { should be_able_to(:manage, Domain.new) }
|
||||
it { should be_able_to(:manage, Contact.new) }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue