Sha256: 566938f34a91901a5a06da6b258594a0e0c305a20a82d4dfde6732f6879d4932

Contents?: true

Size: 1.1 KB

Versions: 1

Compression:

Stored size: 1.1 KB

Contents

require 'rspec/core' 

require 'dm-core'
require 'dm-types'
require 'dm-migrations'

require 'cancan/matchers'
require 'cancan-permits'
require 'cancan-permits/rspec'

# gem install dm-core dm-sqlite-adapter 
# gem install dm-types dm-validations dm-timestamps dm-aggregates dm-adjust dm-is-list dm-is-tree dm-is-versioned dm-is-nested_set 
# gem install rails_datamapper dm-migrations dm-observer

DataMapper::Logger.new($stdout, :debug)                 
DataMapper.setup(:default, 'sqlite::memory:')

RSpec.configure do |config|
  config.mock_with :mocha
end


require_all File.dirname(__FILE__) + '/../cancan-permits/fixtures/permits'
require_all File.dirname(__FILE__) + '/models/all_models'

RSpec.configure do |config|
  config.mock_with :mocha
end

module Permits::Roles
  def self.available
    User.roles
  end
end

class User
  include DataMapper::Resource  

  property :id, Serial  
  property :role, String
  property :name, String 


  def self.roles
    [:guest, :admin, :editor]
  end    
  
  def has_role? role
    self.role.to_sym == role.to_sym
  end
end

DataMapper.finalize
DataMapper.auto_migrate!


Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cancan-permits-0.2.2 spec/data_mapper/spec_helper.rb