-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1436 from alphagov/dont-create-zendesk-users
Don't create Zendesk account for new user requests
- Loading branch information
Showing
5 changed files
with
2 additions
and
43 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
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
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 |
---|---|---|
|
@@ -26,26 +26,18 @@ def valid_create_user_request_params | |
|
||
before do | ||
login_as create(:user_manager) | ||
zendesk_has_no_user_with_email(@user.email) | ||
stub_support_api_organisations_list | ||
end | ||
|
||
it "submits the request to Zendesk and creates a Zendesk user with the requested user details" do | ||
zendesk_has_no_user_with_email(valid_requested_user_params["email"]) | ||
it "submits the request to Zendesk" do | ||
stub_ticket_creation = stub_support_api_valid_raise_support_ticket( | ||
hash_including("tags" => %w[govt_form create_new_user]), | ||
) | ||
stub_user_creation = stub_zendesk_user_creation( | ||
email: "[email protected]", | ||
name: "subject", | ||
verified: true, | ||
) | ||
|
||
post :create, params: valid_create_user_request_params | ||
|
||
expect(request).to redirect_to("/acknowledge") | ||
expect(stub_ticket_creation).to have_been_made | ||
expect(stub_user_creation).to have_been_made | ||
end | ||
|
||
it "re-displays the form with error messages if validation fails" do | ||
|
@@ -61,17 +53,4 @@ def valid_create_user_request_params | |
|
||
expect(response.body).to have_css("select option[selected='selected'][value='Cabinet Office (CO)']") | ||
end | ||
|
||
it "doesn't expose an error to the user when automatic user creation goes wrong" do | ||
zendesk_is_unavailable | ||
|
||
allow_any_instance_of(Zendesk::ZendeskTickets).to receive(:raise_ticket) | ||
|
||
expect(GovukError).to receive(:notify) | ||
.with(kind_of(ZendeskAPI::Error::ClientError)) | ||
|
||
post :create, params: valid_create_user_request_params | ||
|
||
expect(response).to redirect_to("/acknowledge") | ||
end | ||
end |
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 |
---|---|---|
|
@@ -12,8 +12,6 @@ | |
end | ||
|
||
scenario "changing user permissions" do | ||
zendesk_has_user(email: "[email protected]", name: "Bob Fields") | ||
|
||
ticket_request = expect_zendesk_to_receive_ticket( | ||
"subject" => "Change an existing user's account", | ||
"requester" => hash_including("name" => "John Smith", "email" => "[email protected]"), | ||
|
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 |
---|---|---|
|
@@ -22,8 +22,6 @@ | |
}, | ||
]) | ||
|
||
zendesk_has_no_user_with_email("[email protected]") | ||
|
||
ticket_request = expect_zendesk_to_receive_ticket( | ||
"subject" => "Create a new user account", | ||
"requester" => hash_including("name" => "John Smith", "email" => "[email protected]"), | ||
|
@@ -50,13 +48,6 @@ | |
[Additional comments] | ||
XXXX", | ||
) | ||
|
||
user_creation_request = stub_zendesk_user_creation( | ||
email: "[email protected]", | ||
name: "Bob Fields", | ||
verified: true, | ||
) | ||
|
||
visit "/" | ||
|
||
click_on "Create a new user" | ||
|
@@ -73,6 +64,5 @@ | |
user_submits_the_request_successfully | ||
|
||
expect(ticket_request).to have_been_made | ||
expect(user_creation_request).to have_been_made | ||
end | ||
end |