Module: Pebblebed::RSpecHelper

Defined in:
lib/pebblebed/rspec_helper.rb

Instance Method Summary collapse

Instance Method Details

#another_identityObject



23
24
25
26
# File 'lib/pebblebed/rspec_helper.rb', line 23

def another_identity
  id = current_identity ? (current_identity.id + 1) : 1
  DeepStruct.wrap(deep_stringify_keys({:id => id, :god => false}.merge(default_identity_options)))
end

#current_identityObject



19
20
21
# File 'lib/pebblebed/rspec_helper.rb', line 19

def current_identity
  @current_identity
end

#god!(options = {}) ⇒ Object



5
6
7
8
# File 'lib/pebblebed/rspec_helper.rb', line 5

def god!(options = {})
  options.delete(:god)
  stub_current_identity({:id => 1, :god => true}.merge(options))
end

#guest!Object



15
16
17
# File 'lib/pebblebed/rspec_helper.rb', line 15

def guest!
  stub_current_identity
end

#user!(options = {}) ⇒ Object



10
11
12
13
# File 'lib/pebblebed/rspec_helper.rb', line 10

def user!(options = {})
  options.delete(:god)
  stub_current_identity({:id => 1, :god => false}.merge(options))
end