Sha256: f210a1f9ac48547781a23c4ae57a9c3c3b9ba08f3c253ac6f81007f907462a62
Contents?: true
Size: 1001 Bytes
Versions: 1
Compression:
Stored size: 1001 Bytes
Contents
require 'rspec/core' require 'mongoid' require 'cancan/matchers' require 'cancan-permits' require 'cancan-permits/rspec' 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 Mongoid::Document field :role, :type => String field :name, :type => String def self.roles [:guest, :admin, :editor] end def has_role? role self.role.to_sym == role.to_sym end end Mongoid.configure.master = Mongo::Connection.new.db('cancan_permits') module Database def self.teardown Mongoid.database.collections.each do |coll| coll.remove end end end RSpec.configure do |config| config.mock_with :mocha config.before do Mongoid.database.collections.each do |coll| coll.remove end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
cancan-permits-0.2.2 | spec/mongoid/spec_helper.rb |