From 6ef2c44f57d96cba3e3ea8a0334225868f169b29 Mon Sep 17 00:00:00 2001 From: Ryan Bates Date: Wed, 28 Sep 2011 10:08:21 -0700 Subject: [PATCH] fixing model comparison spec, I believe this bug is caused by recent version of with_model --- spec/cancan/model_adapters/active_record_adapter_spec.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/spec/cancan/model_adapters/active_record_adapter_spec.rb b/spec/cancan/model_adapters/active_record_adapter_spec.rb index c22e972..44c1d28 100644 --- a/spec/cancan/model_adapters/active_record_adapter_spec.rb +++ b/spec/cancan/model_adapters/active_record_adapter_spec.rb @@ -131,8 +131,9 @@ if ENV["MODEL_ADAPTER"].nil? || ENV["MODEL_ADAPTER"] == "active_record" category2 = Category.create!(:visible => true) article1 = Article.create!(:secret => true, :category => category1) article2 = Article.create!(:secret => true, :category => category2) - category1.articles.accessible_by(@ability).should == [article1] - end + # for some reason the objects aren't comparing equally here so it's necessary to compare by id + category1.articles.accessible_by(@ability).map(&:id).should == [article1.id] + end it "should raise an exception when trying to merge scope with other conditions" do @ability.can :read, :articles, :published => true