Update specs for MongoidAdditions to use rr mocks
This commit is contained in:
parent
f6aaa581ef
commit
5ebca1f9bf
|
@ -97,8 +97,8 @@ describe CanCan::MongoidAdditions do
|
||||||
describe "activates only when there are Criteria in the hash" do
|
describe "activates only when there are Criteria in the hash" do
|
||||||
it "Calls where on the model class when there are criteria" do
|
it "Calls where on the model class when there are criteria" do
|
||||||
obj = @model_class.create :title => 'Bird'
|
obj = @model_class.create :title => 'Bird'
|
||||||
@conditions = {:title.nin => ["Fork", "Spoon"]}
|
@conditions = {:title.nin => ["Fork", "Spoon"]}
|
||||||
@model_class.should_receive(:where).with(@conditions) {[obj]}
|
mock(@model_class).where(@conditions) {[obj]}
|
||||||
@ability.can :read, @model_class, @conditions
|
@ability.can :read, @model_class, @conditions
|
||||||
@ability.can?(:read, obj)
|
@ability.can?(:read, obj)
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,11 +5,9 @@ require 'supermodel' # shouldn't Bundler do this already?
|
||||||
require 'active_support/all'
|
require 'active_support/all'
|
||||||
require 'matchers'
|
require 'matchers'
|
||||||
require 'cancan/matchers'
|
require 'cancan/matchers'
|
||||||
require 'mongoid'
|
|
||||||
require 'active_support'
|
|
||||||
|
|
||||||
RSpec.configure do |config|
|
RSpec.configure do |config|
|
||||||
config.mock_with :rspec
|
config.mock_with :rr
|
||||||
config.before(:each) do
|
config.before(:each) do
|
||||||
Project.delete_all
|
Project.delete_all
|
||||||
Category.delete_all
|
Category.delete_all
|
||||||
|
|
Loading…
Reference in New Issue
Block a user