Sha256: 58a0f84e2499150a074883a9b9259ebef3ca878bc8cc5c3d3b1438877a2a3552

Contents?: true

Size: 824 Bytes

Versions: 1

Compression:

Stored size: 824 Bytes

Contents

begin
  require 'padrino-gen'
  Padrino::Generators.load_paths << Dir[File.dirname(__FILE__) + '/lazy-head-gen/{bootstrapped_admin_app,admin_controller_test,scaffold}.rb']
rescue LoadError
  # Fail silently
end

module LazyHeadGen

  # Allows testing as a logged in admin user
  #
  # param [Account] account - The account to attempt login with
  def login_as_admin(account)
    post "/admin/sessions/create", {
      :email => account.email, :password => "password"
    }
    follow_redirect!
  end

  # Standard assertions to test when an admin user is not logged in
  # and trys to view an admin page
  #
  def assert_admin_not_logged_in
    assert !last_response.ok?
    assert_equal 302, last_response.status
    assert_equal "http://example.org/admin/sessions/new", last_response.original_headers["Location"]
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
lazy-head-gen-0.5.0 lib/lazy-head-gen.rb