From 898e9b3451b67a97ce4f7eb9cfc751d41fe51a46 Mon Sep 17 00:00:00 2001 From: Christoph Matthies Date: Tue, 19 Mar 2019 12:17:21 +0100 Subject: [PATCH] Fix(specs): adapt to changed HTML. Make more robust. --- spec/end_to_end/end_to_end_spec.rb | 12 ++++++------ spec/views/vms/index.html.erb_spec.rb | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/spec/end_to_end/end_to_end_spec.rb b/spec/end_to_end/end_to_end_spec.rb index 3d63f97a..a3aa3385 100644 --- a/spec/end_to_end/end_to_end_spec.rb +++ b/spec/end_to_end/end_to_end_spec.rb @@ -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) @@ -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) diff --git a/spec/views/vms/index.html.erb_spec.rb b/spec/views/vms/index.html.erb_spec.rb index 5c297ac9..73dab380 100644 --- a/spec/views/vms/index.html.erb_spec.rb +++ b/spec/views/vms/index.html.erb_spec.rb @@ -81,8 +81,8 @@ 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 @@ -90,7 +90,7 @@ 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 @@ -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