-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
14 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,50 +9,55 @@ class ProfilesTest < ActionDispatch::IntegrationTest | |
|
||
test "should get index" do | ||
get profiles_url | ||
|
||
assert_response :success | ||
end | ||
|
||
test "should get show" do | ||
get profile_url(profiles(:one)) | ||
|
||
assert_response :success | ||
end | ||
|
||
test "should get new" do | ||
get new_profile_url, | ||
headers: { Authorization: ActionController::HttpAuthentication::Basic.encode_credentials(Rails.application.secrets.cms_user, Rails.application.secrets.cms_password) } | ||
headers: {Authorization: ActionController::HttpAuthentication::Basic.encode_credentials(Rails.application.secrets.cms_user, Rails.application.secrets.cms_password)} | ||
|
||
assert_response :success | ||
end | ||
|
||
test "should get edit" do | ||
get edit_profile_url(profiles(:one)), | ||
headers: { Authorization: ActionController::HttpAuthentication::Basic.encode_credentials(Rails.application.secrets.cms_user, Rails.application.secrets.cms_password) } | ||
headers: {Authorization: ActionController::HttpAuthentication::Basic.encode_credentials(Rails.application.secrets.cms_user, Rails.application.secrets.cms_password)} | ||
|
||
assert_response :success | ||
end | ||
|
||
test "should create profile" do | ||
assert_difference('Profile.count') do | ||
assert_difference("Profile.count") do | ||
post profiles_url, | ||
params: { profile: { first_name: "John", last_name: "Doe", email: "[email protected]" } }, | ||
headers: { Authorization: ActionController::HttpAuthentication::Basic.encode_credentials(Rails.application.secrets.cms_user, Rails.application.secrets.cms_password) } | ||
params: {profile: {first_name: "John", last_name: "Doe", email: "[email protected]"}}, | ||
headers: {Authorization: ActionController::HttpAuthentication::Basic.encode_credentials(Rails.application.secrets.cms_user, Rails.application.secrets.cms_password)} | ||
end | ||
|
||
assert_redirected_to profile_url(Profile.last) | ||
end | ||
|
||
test "should update profile" do | ||
patch profile_url(@profile), | ||
params: { profile: { first_name: "John" } }, | ||
headers: { Authorization: ActionController::HttpAuthentication::Basic.encode_credentials(Rails.application.secrets.cms_user, Rails.application.secrets.cms_password) } | ||
params: {profile: {first_name: "John"}}, | ||
headers: {Authorization: ActionController::HttpAuthentication::Basic.encode_credentials(Rails.application.secrets.cms_user, Rails.application.secrets.cms_password)} | ||
|
||
@profile.reload | ||
|
||
assert_redirected_to profile_url(@profile) | ||
assert_equal "John", @profile.first_name | ||
end | ||
|
||
test "should destroy profile" do | ||
assert_difference('Profile.count', -1) do | ||
assert_difference("Profile.count", -1) do | ||
delete profile_url(@profile), | ||
headers: { Authorization: ActionController::HttpAuthentication::Basic.encode_credentials(Rails.application.secrets.cms_user, Rails.application.secrets.cms_password) } | ||
headers: {Authorization: ActionController::HttpAuthentication::Basic.encode_credentials(Rails.application.secrets.cms_user, Rails.application.secrets.cms_password)} | ||
end | ||
|
||
assert_redirected_to profiles_url | ||
|