From 5ebca1f9bf09e4383ef887c4ee77bce1e29bf115 Mon Sep 17 00:00:00 2001 From: Mani Tadayon Date: Tue, 16 Nov 2010 15:47:07 -0800 Subject: [PATCH] Update specs for MongoidAdditions to use rr mocks --- spec/cancan/mongoid_additions_spec.rb | 4 ++-- spec/spec_helper.rb | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/spec/cancan/mongoid_additions_spec.rb b/spec/cancan/mongoid_additions_spec.rb index ba9da0b..986ef28 100644 --- a/spec/cancan/mongoid_additions_spec.rb +++ b/spec/cancan/mongoid_additions_spec.rb @@ -97,8 +97,8 @@ describe CanCan::MongoidAdditions do describe "activates only when there are Criteria in the hash" do it "Calls where on the model class when there are criteria" do obj = @model_class.create :title => 'Bird' - @conditions = {:title.nin => ["Fork", "Spoon"]} - @model_class.should_receive(:where).with(@conditions) {[obj]} + @conditions = {:title.nin => ["Fork", "Spoon"]} + mock(@model_class).where(@conditions) {[obj]} @ability.can :read, @model_class, @conditions @ability.can?(:read, obj) end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 0d0be82..da6b77b 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -5,11 +5,9 @@ require 'supermodel' # shouldn't Bundler do this already? require 'active_support/all' require 'matchers' require 'cancan/matchers' -require 'mongoid' -require 'active_support' RSpec.configure do |config| - config.mock_with :rspec + config.mock_with :rr config.before(:each) do Project.delete_all Category.delete_all