From 17043ca61cfdc599cbf47ce8f61b39474aec2d92 Mon Sep 17 00:00:00 2001 From: Max Prokopiev Date: Thu, 5 Jul 2012 19:04:15 +0400 Subject: [PATCH] Fix mongoid example according to ability precedence. Closes #672 --- spec/cancan/model_adapters/mongoid_adapter_spec.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/spec/cancan/model_adapters/mongoid_adapter_spec.rb b/spec/cancan/model_adapters/mongoid_adapter_spec.rb index 451e609..9fe4294 100644 --- a/spec/cancan/model_adapters/mongoid_adapter_spec.rb +++ b/spec/cancan/model_adapters/mongoid_adapter_spec.rb @@ -83,14 +83,13 @@ if ENV["MODEL_ADAPTER"] == "mongoid" MongoidProject.accessible_by(@ability, :destroy).entries.should == [sir] end - it "is able to mix empty conditions and hashes" do - pending "TODO figure out why this isn't working" + it "takes presedence over rule defined without a condition" do @ability.can :read, :mongoid_projects @ability.can :read, :mongoid_projects, :title => 'Sir' sir = MongoidProject.create(:title => 'Sir') lord = MongoidProject.create(:title => 'Lord') - MongoidProject.accessible_by(@ability, :read).count.should == 2 + MongoidProject.accessible_by(@ability, :read).entries.should == [sir] end it "returns everything when the defined ability is access all" do