Sha256: 89860eefc75044e1535cba53e84c2a693f80de58aa4120d6a9f7da5739f2056c

Contents?: true

Size: 654 Bytes

Versions: 41

Compression:

Stored size: 654 Bytes

Contents

require 'spec_helper'

describe AccountRole do
  subject {
    user = Fabricate( :user )
    user.account_users.first.roles.destroy_all
    @account_user = user.account_users.first
    Fabricate( :account_role, :account_user => @account_user )
  }

  it { should belong_to :account_user }
  it { should validate_uniqueness_of(:name).scoped_to(:account_user_id) }
  it { should validate_presence_of(:account_user) }

  it 'should only accept configured roles' do
    subject.name = "not a role"
    subject.should_not be_valid
  end

  it 'roles class method should return available roles' do
    AccountRole.roles.should == APP_ROLES['roles']
  end

end

Version data entries

41 entries across 41 versions & 1 rubygems

Version Path
iugusdk-1.0.11 spec/models/account_role_spec.rb
iugusdk-1.0.10 spec/models/account_role_spec.rb
iugusdk-1.0.9 spec/models/account_role_spec.rb
iugusdk-1.0.8 spec/models/account_role_spec.rb
iugusdk-1.0.7 spec/models/account_role_spec.rb
iugusdk-1.0.6 spec/models/account_role_spec.rb
iugusdk-1.0.5 spec/models/account_role_spec.rb
iugusdk-1.0.4 spec/models/account_role_spec.rb
iugusdk-1.0.3 spec/models/account_role_spec.rb
iugusdk-1.0.2 spec/models/account_role_spec.rb
iugusdk-1.0.1 spec/models/account_role_spec.rb
iugusdk-1.0.0.alpha.32 spec/models/account_role_spec.rb
iugusdk-1.0.0.alpha.31 spec/models/account_role_spec.rb
iugusdk-1.0.0.alpha.30 spec/models/account_role_spec.rb
iugusdk-1.0.0.alpha.29 spec/models/account_role_spec.rb
iugusdk-1.0.0.alpha.28 spec/models/account_role_spec.rb
iugusdk-1.0.0.alpha.27 spec/models/account_role_spec.rb
iugusdk-1.0.0.alpha.26 spec/models/account_role_spec.rb
iugusdk-1.0.0.alpha.25 spec/models/account_role_spec.rb
iugusdk-1.0.0.alpha.24 spec/models/account_role_spec.rb