2024-08-01 21:41:42 -04:00
|
|
|
require "test_helper"
|
|
|
|
|
|
|
|
class SessionsControllerTest < ActionDispatch::IntegrationTest
|
|
|
|
test "should get new" do
|
|
|
|
get new_session_url
|
|
|
|
assert_response :success
|
|
|
|
end
|
|
|
|
|
|
|
|
test "should create session" do
|
|
|
|
user = users(:one)
|
|
|
|
params = {
|
|
|
|
session: {
|
|
|
|
email: user.email,
|
|
|
|
password: "secret"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
post sessions_url, params: params
|
|
|
|
|
|
|
|
assert_redirected_to root_url
|
|
|
|
end
|
|
|
|
|
|
|
|
test "should destroy session" do
|
2024-09-08 21:07:51 -04:00
|
|
|
login(users(:one).email)
|
2024-08-01 21:41:42 -04:00
|
|
|
delete session_url(@session)
|
|
|
|
|
2024-09-08 21:07:51 -04:00
|
|
|
assert_redirected_to new_session_url
|
2024-08-01 21:41:42 -04:00
|
|
|
end
|
|
|
|
end
|