From ff9a91705bac92621c09f605563c544d7ddddae2 Mon Sep 17 00:00:00 2001 From: Sokolov Yura Date: Mon, 13 Sep 2010 22:10:09 +0800 Subject: [PATCH] add specs for module definitions --- spec/cancan/ability_spec.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/spec/cancan/ability_spec.rb b/spec/cancan/ability_spec.rb index 0b0fe5f..9f8886e 100644 --- a/spec/cancan/ability_spec.rb +++ b/spec/cancan/ability_spec.rb @@ -249,6 +249,14 @@ describe CanCan::Ability do @ability.can?(:read, 1..5).should be_false @ability.can?(:read, Range).should be_true end + + it "should allow to check ability for Module" do + module B; end + class A; include B; end + @ability.can :read, B + @ability.can?(:read, A).should be_true + @ability.can?(:read, A.new).should be_true + end it "passing a hash of subjects should check permissions through association" do @ability.can :read, Range, :string => {:length => 3}