Skip to content
This repository
Browse code

Failling test for nested resources with a scope for conditions

  • Loading branch information...
commit 81f00f902422c1de6bb578a6334967ce8f8fc809 1 parent 7bcfd3d
Florent Piteau flop authored
9 spec/cancan/model_adapters/active_record_adapter_spec.rb
@@ -125,6 +125,15 @@
125 125 Article.accessible_by(@ability).should == [article1]
126 126 end
127 127
  128 + it "should only fetch associated records for nested controllers" do
  129 + @ability.can :read, Article, Article.where(:secret => true)
  130 + category1 = Category.create!(:visible => false)
  131 + category2 = Category.create!(:visible => true)
  132 + article1 = Article.create!(:secret => true, :category => category1)
  133 + article2 = Article.create!(:secret => true, :category => category2)
  134 + category1.articles.accessible_by(@ability).should == [article1]
  135 + end
  136 +
128 137 it "should raise an exception when trying to merge scope with other conditions" do
129 138 @ability.can :read, Article, :published => true
130 139 @ability.can :read, Article, Article.where(:secret => true)

0 comments on commit 81f00f9

Please sign in to comment.
Something went wrong with that request. Please try again.