Module: EspAuth::SpecHelper
- Defined in:
- lib/esp_auth/spec_helper.rb
Instance Method Summary collapse
- #ability_for(user) ⇒ Object
- #another_subcontext(context) ⇒ Object
- #another_user ⇒ Object
- #child_1 ⇒ Object
- #child_1_1 ⇒ Object
- #child_1_2 ⇒ Object
- #child_2 ⇒ Object
- #create_context(parent = nil) ⇒ Object
- #create_subcontext(context) ⇒ Object
- #root ⇒ Object
- #subcontext(context) ⇒ Object
- #user ⇒ Object
Instance Method Details
#ability_for(user) ⇒ Object
4 5 6 |
# File 'lib/esp_auth/spec_helper.rb', line 4 def ability_for(user) Ability.new(user) end |
#another_subcontext(context) ⇒ Object
48 49 50 |
# File 'lib/esp_auth/spec_helper.rb', line 48 def another_subcontext(context) @another_subcontext ||= create_subcontext(context) end |
#another_user ⇒ Object
12 13 14 |
# File 'lib/esp_auth/spec_helper.rb', line 12 def another_user @another_user ||= User.create! :uid => 2, :name => 'Another user' end |
#child_1 ⇒ Object
28 29 30 |
# File 'lib/esp_auth/spec_helper.rb', line 28 def child_1 @child_1 ||= create_context root end |
#child_1_1 ⇒ Object
32 33 34 |
# File 'lib/esp_auth/spec_helper.rb', line 32 def child_1_1 @child_1_1 ||= create_context child_1 end |
#child_1_2 ⇒ Object
36 37 38 |
# File 'lib/esp_auth/spec_helper.rb', line 36 def child_1_2 @child_1_2 ||= create_context child_1 end |
#child_2 ⇒ Object
40 41 42 |
# File 'lib/esp_auth/spec_helper.rb', line 40 def child_2 @child_2 ||= create_context root end |
#create_context(parent = nil) ⇒ Object
16 17 18 |
# File 'lib/esp_auth/spec_helper.rb', line 16 def create_context(parent=nil) Context.create! :title => 'context', :parent => parent end |
#create_subcontext(context) ⇒ Object
20 21 22 |
# File 'lib/esp_auth/spec_helper.rb', line 20 def create_subcontext(context) Subcontext.create! :title => 'subcontext', :context => context end |
#root ⇒ Object
24 25 26 |
# File 'lib/esp_auth/spec_helper.rb', line 24 def root @root ||= create_context end |
#subcontext(context) ⇒ Object
44 45 46 |
# File 'lib/esp_auth/spec_helper.rb', line 44 def subcontext(context) @subcontext ||= create_subcontext(context) end |
#user ⇒ Object
8 9 10 |
# File 'lib/esp_auth/spec_helper.rb', line 8 def user @user ||= User.create! :uid => 1, :name => 'User' end |