module Tuberack::Helpers
Public Instance Methods
can(object)
click to toggle source
# File lib/tuberack/helpers.rb, line 21 def can object cancan_ability unless defined? @ability @ability.can :manage, object end
cancan_ability()
click to toggle source
# File lib/tuberack/helpers.rb, line 14 def cancan_ability @ability = Object.new @ability.extend(CanCan::Ability) @controller.stubs(:current_user).returns(current_user) @controller.stubs(:current_ability).returns(@ability) end
cannot(object)
click to toggle source
# File lib/tuberack/helpers.rb, line 26 def cannot object cancan_ability unless defined? @ability @ability.cannot :manage, object end
integration_login()
click to toggle source
# File lib/tuberack/helpers.rb, line 3 def integration_login current_user.stubs(:has_role?).returns(true) login_as current_user end
user_ability(role)
click to toggle source
# File lib/tuberack/helpers.rb, line 8 def user_ability role current_user.stubs(:has_role?).returns(false) current_user.stubs(:has_role?).with(role).returns(true) current_user end