Module: Sorcery::TestHelpers::Sinatra::InstanceMethods
- Included in:
- Internal::Sinatra, Internal::SinatraModular
- Defined in:
- lib/sorcery/test_helpers/sinatra.rb
Instance Method Summary collapse
Instance Method Details
#get_sinatra_app(app) ⇒ Object
30 31 32 33 34 35 |
# File 'lib/sorcery/test_helpers/sinatra.rb', line 30 def get_sinatra_app(app) while !app.kind_of? ::Sinatra::Base do app = app.instance_variable_get(:@app) end app end |
#login_user(user = nil) ⇒ Object
37 38 39 40 41 |
# File 'lib/sorcery/test_helpers/sinatra.rb', line 37 def login_user(user=nil) user ||= @user get_sinatra_app(app).send(:login_user, user) get_sinatra_app(app).send(:after_login!, user, [user.send(user.sorcery_config.username_attribute_names.first), 'secret']) end |
#logout_user ⇒ Object
43 44 45 |
# File 'lib/sorcery/test_helpers/sinatra.rb', line 43 def logout_user get_sinatra_app(app).send(:logout) end |