Added a spec for staff? and regular?

This commit is contained in:
Leonard Garvey 2013-05-18 18:07:07 +10:00
parent b16705be0d
commit 3de632f892
1 changed files with 40 additions and 0 deletions

View File

@ -321,6 +321,46 @@ describe User do
end
describe 'staff and regular users' do
let(:user) { Fabricate.build(:user) }
describe '#staff?' do
subject { user.staff? }
it { should be_false }
context 'for a moderator user' do
before { user.moderator = true }
it { should be_true }
end
context 'for an admin user' do
before { user.admin = true }
it { should be_true }
end
end
describe '#regular?' do
subject { user.regular? }
it { should be_true }
context 'for a moderator user' do
before { user.moderator = true }
it { should be_false }
end
context 'for an admin user' do
before { user.admin = true }
it { should be_false }
end
end
end
describe 'temporary_key' do
let(:user) { Fabricate(:user) }