Sha256: 08d658f34e33af56731c4c304fd1941fd5cbbbeedc7881f32b7d2802fb7572e5

Contents?: true

Size: 1019 Bytes

Versions: 15

Compression:

Stored size: 1019 Bytes

Contents

require 'spec_helper' 
require 'mongo_mapper'

Permits::Ability.orm = :mongo_mapper

MongoMapper.database = 'cancan-permits_mongo_mapper'

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 MongoMapper::Document
  
  key :role, String
  key :name, String  

  def self.roles
    [:guest, :admin, :editor]
  end    
  
  def has_role? role
    self.role.to_sym == role.to_sym
  end     
end
                
module Database
  def self.teardown
    # MongoMapper.database.collections.each {|collection| collection.drop }    
    MongoMapper.database.collections.each do |coll|
      coll.drop unless coll.name =~ /(.*\.)?system\..*/
    end    
  end
end


RSpec.configure do |config|
  config.mock_with :mocha
  config.before do
    MongoMapper.database.collections.each do |coll|
      coll.drop unless coll.name =~ /(.*\.)?system\..*/
    end    
  end
end




Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
cancan-permits-0.3.12 spec/mongo_mapper/spec_helper.rb
cancan-permits-0.3.11 spec/mongo_mapper/spec_helper.rb
cancan-permits-0.3.10 spec/mongo_mapper/spec_helper.rb
cancan-permits-0.3.9 spec/mongo_mapper/spec_helper.rb
cancan-permits-0.3.8 spec/mongo_mapper/spec_helper.rb
cancan-permits-0.3.7 spec/mongo_mapper/spec_helper.rb
cancan-permits-0.3.6 spec/mongo_mapper/spec_helper.rb
cancan-permits-0.3.5 spec/mongo_mapper/spec_helper.rb
cancan-permits-0.3.4 spec/mongo_mapper/spec_helper.rb
cancan-permits-0.3.2 spec/mongo_mapper/spec_helper.rb
cancan-permits-0.3.1 spec/mongo_mapper/spec_helper.rb
cancan-permits-0.3.0 spec/mongo_mapper/spec_helper.rb
cancan-permits-0.2.9 spec/mongo_mapper/spec_helper.rb
cancan-permits-0.2.8 spec/mongo_mapper/spec_helper.rb
cancan-permits-0.2.7 spec/mongo_mapper/spec_helper.rb