Skip to content

Commit

Permalink
Fix(specs): adapt to changed HTML. Make more robust.
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisma committed Mar 19, 2019
1 parent c4bafb8 commit 898e9b3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
12 changes: 6 additions & 6 deletions spec/end_to_end/end_to_end_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
describe 'Request Process'
it 'is possible to request a new VM' do
sign_in @employee
visit '/vms/vm'
click_on '+'
expect(page).to have_current_path('/vms/requests/new')
visit vms_path
find("a[href='#{new_request_path}']").click
expect(page).to have_current_path(new_request_path)
fill_in('Name', with: @requestname)
fill_in('cpu', with: 4)
fill_in('ram', with: 8)
Expand All @@ -45,11 +45,11 @@
click_on @requestname
expect(page.body).to have_text('Request Information')
end

it 'is possible to accept a VM request' do
sign_in @admin
visit '/vms/vm'
click_on '+'
visit vms_path
find("a[href='#{new_request_path}']").click
fill_in('Name', with: @requestname)
fill_in('cpu', with: 4)
fill_in('ram', with: 8)
Expand Down
8 changes: 4 additions & 4 deletions spec/views/vms/index.html.erb_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,16 +81,16 @@
context 'when the user is a user' do
let(:current_user) { FactoryBot.create :user }

it 'does not link to new vm page' do
expect(rendered).not_to have_button('+')
it 'does not link to new vm request page' do
expect(rendered).not_to have_link(nil, href: new_request_path)
end
end

context 'when the user is an employee' do
let(:current_user) { FactoryBot.create :employee }

it 'links to new vm page' do
expect(rendered).to have_button('+')
expect(rendered).to have_link(nil, href: new_request_path)
end
end

Expand All @@ -113,7 +113,7 @@
end

it 'links to new vm page' do
expect(rendered).to have_button('+')
expect(rendered).to have_link(nil, href: new_request_path)
end
end
end

0 comments on commit 898e9b3

Please sign in to comment.