Sha256: 61edeed22b6cb4ebc7907c784132ac352027620d43a48213879e18acf48c745e
Contents?: true
Size: 762 Bytes
Versions: 1
Compression:
Stored size: 762 Bytes
Contents
require 'rspec/core' require 'cancan/matchers' require 'cancan-permits' require_all File.dirname(__FILE__) + '/cancan-permits/fixtures/permits' require_all File.dirname(__FILE__) + '/cancan-permits/permits/fixtures' RSpec.configure do |config| config.mock_with :mocha end module Permits::Roles def self.available User.roles end end class User attr_accessor :id, :role, :name def self.roles [:guest, :admin, :editor] end def initialize id, role, name = nil self.id = id raise ArgumentError, "Role #{role} is not in list of available roles: #{self.class.roles}" if !self.class.roles.include? role self.role = role self.name = name || role.to_s end def has_role? role self.role == role end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
cancan-permits-0.1.1 | spec/spec_helper.rb |