So I'm trying to create integration tests for my rails 4.0 application, and I'm unsure how to authorize users (the application uses devise_ldap_authenticatable.
Initally, I attempted:
setup do
sign_in User.find_by_login('john.smith')
end
teardown do
sign_out
end
test "can see index page" do
get "/"
assert_select "table[id=?]", "main_table"
end
Which I can do inside normal rails code. However, this doesn't work. I then found this question, which provided answers for both controller and integration testing.
However, the problem is that the integration testing example:
post_via_redirect Rails.application.routes.url_helpers.user_session_path, 'user[email]' => user.email, 'user[password]' => user.password
Is for basic Devise, and doesn't take into account the use of an LDAP server (which therefore means I do not store passwords).
Does anyone know how to do integration tests when an LDAP server is involved, and login are required?
Aucun commentaire:
Enregistrer un commentaire