Skip to content
This repository has been archived by the owner on Oct 3, 2018. It is now read-only.

Inject login helper for Integration Tests #15

Open
bousquet opened this issue Oct 24, 2012 · 0 comments
Open

Inject login helper for Integration Tests #15

bousquet opened this issue Oct 24, 2012 · 0 comments

Comments

@bousquet
Copy link
Member

Something like this needs to be added and auto-injected into the test suite:

class MiniTest::Rails::ActionDispatch::IntegrationTest

  # Public: Login helper for the thincloud-auth forms using Capybara.
  #
  # identity - Thincloud::Authentication identity object
  #
  # Returns the Capybara session after clicking the login button.
  def login(identity=nil)
    identity ||= create(:identity)

    visit login_path

    within("#login form:first-child") do
      fill_in "auth_key", with: identity.email
      fill_in "password", with: identity.password

      click_button "Login"
    end

    identity
  end

end
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant