-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
A few enhancements to allow GAP account users to better use the system (
- Loading branch information
1 parent
94cb55d
commit a8ab55b
Showing
3 changed files
with
48 additions
and
13 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 |
---|---|---|
|
@@ -19,12 +19,37 @@ | |
|
||
it "shows user fields", js: true do | ||
visit edit_user_path(user_admin) | ||
# These fields are disabled so we cannot target them with | ||
# RSpec `have_field`, but once we make them editable we | ||
# could use the more common syntax. | ||
expect(page.html.include?(user_admin.email)).to be true | ||
expect(page.html.include?(user_admin.uid)).to be true | ||
expect(page.html.include?(user_admin.default_group.title)).to be true | ||
expect(page).to have_field :user_email | ||
expect(page).to have_field :user_uid | ||
expect(page).to have_field :user_default_group_id | ||
end | ||
|
||
it "allows to change other users' default group" do | ||
visit edit_user_path(user) | ||
expect(user.default_group.title).to eq Group.research_data.title | ||
select Group.plasma_laboratory.title, from: :user_default_group_id | ||
click_on "Save" | ||
user.reload | ||
expect(user.default_group.title).to eq Group.plasma_laboratory.title | ||
end | ||
end | ||
|
||
describe "Non-admin users" do | ||
let(:user) { FactoryBot.create :princeton_submitter } | ||
|
||
before { sign_in user } | ||
|
||
it "allows user to change their email", js: true do | ||
visit edit_user_path(user) | ||
fill_in "user_email", with: "[email protected]" | ||
click_on "Save" | ||
user.reload | ||
expect(user.email).to eq "[email protected]" | ||
end | ||
|
||
it "does not allow user to change their default group", js: true do | ||
visit edit_user_path(user) | ||
expect(page.html.include?("user_default_group_id")).to be false | ||
end | ||
end | ||
|
||
|