Sha256: ed8574e567ccc9bdddf602c5eb4a8fedd1e1196b1867f67b87a4a8e0ff40da47

Contents?: true

Size: 1.01 KB

Versions: 10

Compression:

Stored size: 1.01 KB

Contents

require 'spec_helper'

describe User do

  before(:all) do
    @user = FactoryGirl.create(:user)
  end

  it "should allow you to add and remove roles" do
    role = SecurityRole.create(:description => "Test Role", :internal_identifier => 'test role')
    @user.has_role?(role).should eq false
    @user.add_role(role)
    @user.has_role?(role).should eq true
    @user.remove_role(role)
    @user.has_role?(role).should eq false
  end

  it "should allow you to add and remove capabilities" do
    c = FileAsset.add_capability('upload')
    @user.has_capability?('upload','FileAsset').should eq false
    @user.add_capability(c)
    @user.has_capability?('upload','FileAsset').should eq true
    @user.remove_capability(c)
    @user.has_capability?('upload','FileAsset').should eq false
  end

  it "should allow you to add instance attributes" do
    @user.add_instance_attribute(:test, 'result')
    @user.instance_attributes[:test].should eq 'result'
  end

  after(:all) do
    User.destroy_all
    SecurityRole.destroy_all
  end

end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
erp_tech_svcs-4.2.0 spec/models/user_spec.rb
erp_tech_svcs-4.0.0 spec/models/user_spec.rb
erp_tech_svcs-3.1.8 spec/models/user_spec.rb
erp_tech_svcs-3.1.7 spec/models/user_spec.rb
erp_tech_svcs-3.1.5 spec/models/user_spec.rb
erp_tech_svcs-3.1.4 spec/models/user_spec.rb
erp_tech_svcs-3.1.3 spec/models/user_spec.rb
erp_tech_svcs-3.1.2 spec/models/user_spec.rb
erp_tech_svcs-3.1.1 spec/models/user_spec.rb
erp_tech_svcs-3.1.0 spec/models/user_spec.rb