38 lines
1.2 KiB
Ruby
38 lines
1.2 KiB
Ruby
require 'test_helper'
|
|
|
|
class UserProfilesControllerTest < ActionDispatch::IntegrationTest
|
|
setup do
|
|
@user_profile = user_profiles(:one)
|
|
end
|
|
|
|
test "should get index" do
|
|
get user_profiles_url, as: :json
|
|
assert_response :success
|
|
end
|
|
|
|
test "should create user_profile" do
|
|
assert_difference('UserProfile.count') do
|
|
post user_profiles_url, params: { user_profile: { avatar: @user_profile.avatar, dob: @user_profile.dob, role: @user_profile.role, tagline: @user_profile.tagline, user_id: @user_profile.user_id } }, as: :json
|
|
end
|
|
|
|
assert_response 201
|
|
end
|
|
|
|
test "should show user_profile" do
|
|
get user_profile_url(@user_profile), as: :json
|
|
assert_response :success
|
|
end
|
|
|
|
test "should update user_profile" do
|
|
patch user_profile_url(@user_profile), params: { user_profile: { avatar: @user_profile.avatar, dob: @user_profile.dob, role: @user_profile.role, tagline: @user_profile.tagline, user_id: @user_profile.user_id } }, as: :json
|
|
assert_response 200
|
|
end
|
|
|
|
test "should destroy user_profile" do
|
|
assert_difference('UserProfile.count', -1) do
|
|
delete user_profile_url(@user_profile), as: :json
|
|
end
|
|
|
|
assert_response 204
|
|
end
|
|
end
|