Browse files

Spec to test against nested joins being thrown away ala issue 560

  • Loading branch information...
1 parent cfc355c commit b162871c6d0e8189cab428e0526490b17d08be81 @DavidMikeSimon DavidMikeSimon committed Jun 19, 2012
Showing with 6 additions and 0 deletions.
  1. +6 −0 spec/cancan/model_adapters/active_record_adapter_spec.rb
View
6 spec/cancan/model_adapters/active_record_adapter_spec.rb
@@ -227,6 +227,12 @@
@ability.model_adapter(Article, :read).joins.should == [:project]
end
+ it "should merge nested and non-nested joins" do
+ @ability.can :read, Article, :project => { :blocked => false }
+ @ability.can :read, Article, :project => { :comments => { :spam => true } }
+ @ability.model_adapter(Article, :read).joins.should == [{:project=>[:comments]}]
+ end
+
it "should restrict articles given a MetaWhere condition" do
@ability.can :read, Article, :priority.lt => 2
article1 = Article.create!(:priority => 1)

0 comments on commit b162871

Please sign in to comment.