micro-blogger/test/controllers/v1/authentication_controller_test.rb
2018-11-10 20:34:11 -06:00

20 lines
478 B
Ruby

# frozen_string_literal: true
require 'test_helper'
class AuthenticationControllerTest < ActionDispatch::IntegrationTest
setup do
@user = users(:admin)
end
test "should return token" do
post v1_authenticate_url, params: { email: @user.email, password: 'password' }
assert_response :success
end
test "should fail auth" do
post v1_authenticate_url, params: { email: @user.email, password: 'BAD PASSWORD' }
assert_response :unauthorized
end
end