1
0
Fork 0

Add specs to Account#remove_role

This commit is contained in:
Alex Kotov 2019-02-02 09:04:58 +05:00
parent 43b6e08e3f
commit 532c4dae2c
Signed by: kotovalexarian
GPG Key ID: 553C0EBBEB5D5F08
1 changed files with 26 additions and 0 deletions

View File

@ -127,4 +127,30 @@ RSpec.describe Account do
end
end
end
describe '#remove_role' do
subject { create :usual_account }
before do
subject.add_role :superuser
end
let(:result) { subject.remove_role :superuser }
specify do
expect { result }.to change { subject.roles.reload.count }.by(-1)
end
specify do
expect { result }.to change { subject.account_roles.reload.count }.by(-1)
end
specify do
expect { result }.not_to change { Role.count }
end
specify do
expect { result }.to change { AccountRole.count }.by(-1)
end
end
end