Skip to content

Commit

Permalink
Merge branch 'dev' into #431/EditIpAndDns
Browse files Browse the repository at this point in the history
  • Loading branch information
LeonMatthes committed Mar 6, 2019
2 parents 4e5cb74 + 41c4a09 commit 87fa6a6
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 32 deletions.
2 changes: 1 addition & 1 deletion app/views/projects/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<%= form.select 'responsible_user_ids',
options_from_collection_for_select(User.all,
:id,
:email,
:human_readable_identifier,
selected: selected_user_ids),
{},
{ multiple: true, class: "selecttwo form-group", data: { placeholder: 'Responsible users' }}
Expand Down
6 changes: 3 additions & 3 deletions app/views/requests/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
<%= form.select 'responsible_user_ids',
options_from_collection_for_select(User.all,
:id,
:email,
:human_readable_identifier,
@request.responsible_users.collect(&:id)),
{},
{ multiple: true, class: "form-control selecttwo"} %>
Expand Down Expand Up @@ -93,7 +93,7 @@
<%= form.select 'sudo_user_ids',
options_from_collection_for_select(User.all,
:id,
:email,
:human_readable_identifier,
@request.sudo_users.collect(&:id)),
{ },
{ class: 'form-control selecttwo', multiple: true} %>
Expand All @@ -103,7 +103,7 @@
<%= form.select 'user_ids',
options_from_collection_for_select(User.all,
:id,
:email,
:human_readable_identifier,
(@request.users - @request.sudo_users).collect(&:id)),
{ },
{ class: ' selecttwo', multiple: true} %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/servers/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<%= form.select 'responsible',
options_from_collection_for_select(User.all,
:id,
:email),
:human_readable_identifier),
{},
{ multiple: false, class: "selecttwo", style: 'width: 50%' } %>
</div>
Expand Down
4 changes: 2 additions & 2 deletions app/views/vms/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
<div class="field">
<%= form.label :sudo_user_ids, "Users with sudo rights" %>
<%= form.select :sudo_user_ids,
options_from_collection_for_select(User.all, :id, :email, @sudo_user_ids),
options_from_collection_for_select(User.all, :id, :human_readable_identifier, @sudo_user_ids),
{ include_hidden: false},
{ multiple: true, class: 'selecttwo form-control'} %>
</div>

<div class="field">
<%= form.label :non_sudo_user_ids, "Users without sudo rights" %>
<%= form.select :non_sudo_user_ids,
options_from_collection_for_select(User.all, :id, :email, @non_sudo_user_ids),
options_from_collection_for_select(User.all, :id, :human_readable_identifier, @non_sudo_user_ids),
{ include_hidden: false },
{ multiple: true, class: 'selecttwo form-control'} %>
</div>
Expand Down
18 changes: 9 additions & 9 deletions spec/end_to_end/end_to_end_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@
fill_in('cpu', with: 4)
fill_in('ram', with: 8)
fill_in('storage', with: 126)
select(@employee.email, from: 'request_responsible_user_ids')
select(@employee.email, from: 'request_sudo_user_ids')
select(@user.email, from: 'request_user_ids')
select(@employee.human_readable_identifier, from: 'request_responsible_user_ids')
select(@employee.human_readable_identifier, from: 'request_sudo_user_ids')
select(@user.human_readable_identifier, from: 'request_user_ids')
select('none', from: 'operating_system')
select(@project.name, from: 'request_project_id')
fill_in('Description', with: 'test')
Expand All @@ -54,9 +54,9 @@
fill_in('cpu', with: 4)
fill_in('ram', with: 8)
fill_in('storage', with: 126)
select(@admin.email, from: 'request_responsible_user_ids')
select(@admin.email, from: 'request_sudo_user_ids')
select(@user.email, from: 'request_user_ids')
select(@admin.human_readable_identifier, from: 'request_responsible_user_ids')
select(@admin.human_readable_identifier, from: 'request_sudo_user_ids')
select(@user.human_readable_identifier, from: 'request_user_ids')
select(@project.name, from: 'request_project_id')
select('none', from: 'operating_system')
fill_in('Description', with: 'test')
Expand Down Expand Up @@ -88,9 +88,9 @@
fill_in('cpu', with: 4)
fill_in('ram', with: 8)
fill_in('storage', with: 126)
select(@admin.email, from: 'request_responsible_user_ids')
select(@admin.email, from: 'request_sudo_user_ids')
select(@user.email, from: 'request_user_ids')
select(@admin.human_readable_identifier, from: 'request_responsible_user_ids')
select(@admin.human_readable_identifier, from: 'request_sudo_user_ids')
select(@user.human_readable_identifier, from: 'request_user_ids')
select('none', from: 'operating_system')
fill_in('Description', with: 'test')
click_on 'Create Request'
Expand Down
12 changes: 6 additions & 6 deletions spec/features/projects/edit.html.erb_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def submit_button
end

it 'shows the current responsible users' do
expect(page).to have_select('project[responsible_user_ids][]', selected: [employee.email, admin.email])
expect(page).to have_select('project[responsible_user_ids][]', selected: [employee.human_readable_identifier, admin.human_readable_identifier])
end

context 'when the name is empty' do
Expand Down Expand Up @@ -79,8 +79,8 @@ def submit_button

context 'when there is no responsible user selected' do
before do
page.unselect employee.email, from: 'project[responsible_user_ids][]'
page.unselect admin.email, from: 'project[responsible_user_ids][]'
page.unselect employee.human_readable_identifier, from: 'project[responsible_user_ids][]'
page.unselect admin.human_readable_identifier, from: 'project[responsible_user_ids][]'
end

context 'when clicking the submit button' do
Expand All @@ -95,9 +95,9 @@ def submit_button
before do
fill_in 'project[name]', with: project_name
fill_in 'project[description]', with: project_description
page.unselect employee.email, from: 'project[responsible_user_ids][]'
page.unselect admin.email, from: 'project[responsible_user_ids][]'
page.select user.email, from: 'project[responsible_user_ids][]'
page.unselect employee.human_readable_identifier, from: 'project[responsible_user_ids][]'
page.unselect admin.human_readable_identifier, from: 'project[responsible_user_ids][]'
page.select user.human_readable_identifier, from: 'project[responsible_user_ids][]'
end

context 'when clicking the submit button' do
Expand Down
18 changes: 9 additions & 9 deletions spec/features/projects/new.html.erb_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ def submit_button
end

it 'selects the current_user per default' do
expect(page).to have_select('project[responsible_user_ids][]', selected: employee.email)
expect(page).to have_select('project[responsible_user_ids][]', selected: employee.human_readable_identifier)
end

context 'when the name is empty' do
before do
fill_in 'project[description]', with: project_description
page.select employee.email, from: 'project[responsible_user_ids][]'
page.select employee.human_readable_identifier, from: 'project[responsible_user_ids][]'
end

context 'when clicking the submit button' do
Expand All @@ -70,7 +70,7 @@ def submit_button
context 'when the description is empty' do
before do
fill_in 'project[name]', with: project_name
page.select employee.email, from: 'project[responsible_user_ids][]'
page.select employee.human_readable_identifier, from: 'project[responsible_user_ids][]'
end

context 'when clicking the submit button' do
Expand All @@ -85,7 +85,7 @@ def submit_button
before do
fill_in 'project[name]', with: project_name
fill_in 'project[description]', with: project_description
page.unselect employee.email, from: 'project[responsible_user_ids][]'
page.unselect employee.human_readable_identifier, from: 'project[responsible_user_ids][]'
end

context 'when clicking the submit button' do
Expand All @@ -99,14 +99,14 @@ def submit_button
context 'when something is not correctly filled' do
context 'when only multiple responsible users are selected' do
before do
page.select employee.email, from: 'project[responsible_user_ids][]'
page.select admin.email, from: 'project[responsible_user_ids][]'
page.select employee.human_readable_identifier, from: 'project[responsible_user_ids][]'
page.select admin.human_readable_identifier, from: 'project[responsible_user_ids][]'
end

context 'when clicking the submit button' do
it 'still selects the selected responsible user' do
submit_button.click
expect(page).to have_select('project[responsible_user_ids][]', selected: [employee.email, admin.email])
expect(page).to have_select('project[responsible_user_ids][]', selected: [employee.human_readable_identifier, admin.human_readable_identifier])
end
end
end
Expand All @@ -116,7 +116,7 @@ def submit_button
before do
fill_in 'project[name]', with: project_name
fill_in 'project[description]', with: project_description
page.select employee.email, from: 'project[responsible_user_ids][]'
page.select employee.human_readable_identifier, from: 'project[responsible_user_ids][]'
end

context 'when clicking the submit button' do
Expand Down Expand Up @@ -147,7 +147,7 @@ def submit_button
before do
fill_in 'project[name]', with: project_name
fill_in 'project[description]', with: project_description
page.select admin.email, from: 'project[responsible_user_ids][]'
page.select admin.human_readable_identifier, from: 'project[responsible_user_ids][]'
end

context 'when clicking the submit button' do
Expand Down
2 changes: 1 addition & 1 deletion spec/views/requests/new.html.erb_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
assert_select 'textarea[name=?]', 'request[comment]'
end

expect(rendered).to match(user.email)
expect(rendered).to match(user.human_readable_identifier)
end

# regression test for #320
Expand Down

0 comments on commit 87fa6a6

Please sign in to comment.