Sha256: d0d9447f8a8fefed083a42dddba260a3cf75d6c23eb07b231bd2574403f012f5

Contents?: true

Size: 839 Bytes

Versions: 17

Compression:

Stored size: 839 Bytes

Contents

module Sorcery
  module TestHelpers
    module Rails
      module Integration
        # Accepts arguments for user to login, route to use and HTTP method
        # Defaults - @user, 'sessions_url' and POST
        def login_user(user = nil, route = nil, http_method = :post)
          user ||= @user
          route ||= sessions_url

          username_attr = user.sorcery_config.username_attribute_names.first
          username = user.send(username_attr)
          page.driver.send(http_method, route, :"#{username_attr}" => username, :password => 'secret')
        end

        # Accepts route and HTTP method arguments
        # Default - 'logout_url' and GET
        def logout_user(route = nil, http_method = :get)
          route ||= logout_url
          page.driver.send(http_method, route)
        end
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
sorcery-0.17.0 lib/sorcery/test_helpers/rails/integration.rb
sorcery-0.16.5 lib/sorcery/test_helpers/rails/integration.rb
sorcery-0.16.4 lib/sorcery/test_helpers/rails/integration.rb
sorcery-0.16.3 lib/sorcery/test_helpers/rails/integration.rb
sorcery-0.16.2 lib/sorcery/test_helpers/rails/integration.rb
sorcery-0.16.1 lib/sorcery/test_helpers/rails/integration.rb
sorcery-0.15.1 lib/sorcery/test_helpers/rails/integration.rb
sorcery-0.16.0 lib/sorcery/test_helpers/rails/integration.rb
sorcery-0.15.0 lib/sorcery/test_helpers/rails/integration.rb
sorcery-0.14.0 lib/sorcery/test_helpers/rails/integration.rb
sorcery-0.13.0 lib/sorcery/test_helpers/rails/integration.rb
sorcery-0.12.0 lib/sorcery/test_helpers/rails/integration.rb
sorcery-0.11.0 lib/sorcery/test_helpers/rails/integration.rb
sorcery-0.10.3 lib/sorcery/test_helpers/rails/integration.rb
sorcery-0.10.2 lib/sorcery/test_helpers/rails/integration.rb
sorcery-0.10.1 lib/sorcery/test_helpers/rails/integration.rb
sorcery-0.10.0 lib/sorcery/test_helpers/rails/integration.rb