Sha256: d620ddd5f0dfc0860ed2783210602f36347c25ca725b1380fff44991e51e21e7
Contents?: true
Size: 1.04 KB
Versions: 4
Compression:
Stored size: 1.04 KB
Contents
require 'spec_helper' describe User do it { should belong_to :userable } it { should respond_to :userable_type } it { should respond_to :userable_id } it { should respond_to :customer? } it { should respond_to :admin? } describe '#customer?' do context 'when is a customer' do before do @customer_user = Customer.create email: 'test@icalialabs.com' @current_user = @customer_user.user end it 'returns true' do expect(@current_user).to be_customer end end context 'when is not customer' do before do @fake_customer_user = Admin.create email: 'test@icalialabs.com' @current_user = @fake_customer_user.user end it 'returns false' do expect(@current_user).not_to be_customer end end context 'when is an admin' do before do @admin_user = Admin.create email: 'test@icalialabs.com' @current_user = @admin_user.user end it 'returns true' do expect(@current_user).to be_admin end end end end
Version data entries
4 entries across 4 versions & 1 rubygems