Module: Sorcery::TestHelpers
- Defined in:
- lib/sorcery.rb,
lib/sorcery/test_helpers.rb,
lib/sorcery/test_helpers/rails.rb,
lib/sorcery/test_helpers/sinatra.rb
Defined Under Namespace
Instance Method Summary collapse
- #create_new_external_user(provider, attributes_hash = nil) ⇒ Object
- #create_new_user(attributes_hash = nil) ⇒ Object
- #sorcery_model_property_set(property, *values) ⇒ Object
Instance Method Details
#create_new_external_user(provider, attributes_hash = nil) ⇒ Object
18 19 20 21 22 23 |
# File 'lib/sorcery/test_helpers.rb', line 18 def create_new_external_user(provider, attributes_hash = nil) user_attributes_hash = attributes_hash || {:username => 'gizmo', :authentications_attributes => [{:provider => provider, :uid => 123}]} @user = User.new(user_attributes_hash) @user.save! @user end |
#create_new_user(attributes_hash = nil) ⇒ Object
11 12 13 14 15 16 |
# File 'lib/sorcery/test_helpers.rb', line 11 def create_new_user(attributes_hash = nil) user_attributes_hash = attributes_hash || {:username => 'gizmo', :email => "[email protected]", :password => 'secret'} @user = User.new(user_attributes_hash) @user.save! @user end |
#sorcery_model_property_set(property, *values) ⇒ Object
25 26 27 28 29 |
# File 'lib/sorcery/test_helpers.rb', line 25 def sorcery_model_property_set(property, *values) User.class_eval do sorcery_config.send(:"#{property}=", *values) end end |