This repository has been archived by the owner on Apr 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 472
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bsc#978655 Signed-off-by: Miquel Sabaté Solà <[email protected]>
- Loading branch information
Showing
6 changed files
with
119 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
.panel.panel-default | ||
.panel-heading | ||
h5 Edit User | ||
.panel-body | ||
= form_for [:admin, @user], html: {class: 'form-horizontal', role: 'form'} do |f| | ||
.form-group | ||
= f.label :email, {class: 'control-label col-md-2'} | ||
.col-md-7 | ||
= f.email_field(:email, class: 'form-control', required: true, autofocus: true) | ||
|
||
.form-group | ||
.col-md-offset-2.col-md-7 | ||
= f.submit('Update', class: 'btn btn-primary') | ||
|
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
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 |
---|---|---|
|
@@ -65,4 +65,27 @@ | |
expect(page).to have_content("User '#{user.username}' is no longer an admin") | ||
end | ||
end | ||
|
||
describe "Edit user" do | ||
scenario "allows the admin to update a user", js: true do | ||
visit edit_admin_user_path(user) | ||
|
||
fill_in "Email", with: "[email protected]" | ||
click_button "Update" | ||
|
||
wait_for_effect_on("#alert") | ||
expect(page).to have_content("[email protected]") | ||
expect(page).to have_content("User updated successfully") | ||
end | ||
|
||
scenario "disallows the admin to update a user with a wrong name", js: true do | ||
visit edit_admin_user_path(user) | ||
|
||
fill_in "Email", with: admin.email | ||
click_button "Update" | ||
|
||
wait_for_effect_on("#alert") | ||
expect(page).to have_content("has already been taken") | ||
end | ||
end | ||
end |