Sha256: 06e1482f0235f2bc50d80f50a0312622650df4c77a63695c643e00f90b5917bd

Contents?: true

Size: 950 Bytes

Versions: 10

Compression:

Stored size: 950 Bytes

Contents

describe 'Roles Generic API : User class' do
  describe '#in_role' do
    it "should return first user matching role" do        
      if User.respond_to? :in_role
        User.in_role(:guest).first.name.should == 'Guest user'
        User.in_role(:admin).first.name.should == 'Admin user'
      end
    end
  end

  describe '#in_roles' do
    it "should return first user matching role" do        
      if User.respond_to? :in_roles
        User.in_roles(:guest, :user).first.name.should == 'Guest user'      
        User.in_roles(:admin, :guest).should be_empty
      end
    end
  end
  
  describe '#valid_role?' do
    it "should be true that the User class has a valid role of :guest" do      
      User.valid_role?(:guest).should be_true
    end
  end  
  
  describe '#valid_roles' do
    it "should be true that the User class has a valid role of :guest" do      
      User.valid_roles.should include(:guest, :admin)
    end
  end  
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
roles_generic-0.5.0 lib/roles_generic/rspec/api/user_class_api.rb
roles_generic-0.3.9 lib/roles_generic/rspec/api/user_class_api.rb
roles_generic-0.3.8 lib/roles_generic/rspec/api/user_class_api.rb
roles_generic-0.3.7.2 lib/roles_generic/rspec/api/user_class_api.rb
roles_generic-0.3.7.1 lib/roles_generic/rspec/api/user_class_api.rb
roles_generic-0.3.7 lib/roles_generic/rspec/api/user_class_api.rb
roles_generic-0.3.6 lib/roles_generic/rspec/api/user_class_api.rb
roles_generic-0.3.5 lib/roles_generic/rspec/api/user_class_api.rb
roles_generic-0.3.4 lib/roles_generic/rspec/api/user_class_api.rb
roles_generic-0.3.3 lib/roles_generic/rspec/api/user_class_api.rb