micro-blogger/test/controllers/v1/authentication_controller_test.rb

20 lines
478 B
Ruby
Raw Permalink Normal View History

2018-11-10 18:46:47 -06:00
# 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