提交 4e4c5a9a 编写于 作者: R Ryan Bates

adding current_ability to helper methods - closes #361

上级 dde88c92
...@@ -286,7 +286,7 @@ module CanCan ...@@ -286,7 +286,7 @@ module CanCan
def self.included(base) def self.included(base)
base.extend ClassMethods base.extend ClassMethods
base.helper_method :can?, :cannot? base.helper_method :can?, :cannot?, :current_ability
end end
# Raises a CanCan::AccessDenied exception if the current_ability cannot # Raises a CanCan::AccessDenied exception if the current_ability cannot
......
...@@ -6,7 +6,7 @@ describe CanCan::ControllerAdditions do ...@@ -6,7 +6,7 @@ describe CanCan::ControllerAdditions do
@controller = @controller_class.new @controller = @controller_class.new
stub(@controller).params { {} } stub(@controller).params { {} }
stub(@controller).current_user { :current_user } stub(@controller).current_user { :current_user }
mock(@controller_class).helper_method(:can?, :cannot?) mock(@controller_class).helper_method(:can?, :cannot?, :current_ability)
@controller_class.send(:include, CanCan::ControllerAdditions) @controller_class.send(:include, CanCan::ControllerAdditions)
end end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册