-
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.
- Loading branch information
1 parent
3653ef2
commit 69f1118
Showing
3 changed files
with
40 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
36 changes: 36 additions & 0 deletions
36
staff_features/resources/step_definitions/resource_delete.rb
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,36 @@ | ||
# frozen_string_literal: true | ||
|
||
Given 'the user is on the Resource view page' do | ||
visit "#{STAFF_URL}/resources/#{@resource_id}" | ||
|
||
expect(current_url).to include "/resources/#{@resource_id}" | ||
end | ||
|
||
When 'the user checks the checkbox of the Resource' do | ||
find('#multiselect-item').check | ||
row = find('tr.selected') | ||
input = row.find('input') | ||
expect(input.value).to include 'repositories' | ||
expect(input.value).to include 'resource' | ||
|
||
@resource_id = input.value.split('/').pop | ||
end | ||
|
||
Then 'the Resource is deleted' do | ||
expect(@resource_id).to_not eq nil | ||
|
||
visit "#{STAFF_URL}/resources/#{@resource_id}/edit" | ||
|
||
expect(find('h2').text).to eq 'Record Not Found' | ||
|
||
expected_text = "The record you've tried to access may no longer exist or you may not have permission to view it." | ||
expect(page).to have_text expected_text | ||
end | ||
|
||
Then 'the Resources page is displayed' do | ||
expect(find('h2').text).to have_text 'Resources' | ||
end | ||
|
||
Then 'the user is still on the Resource view page' do | ||
expect(current_url).to include "resources/#{@resource_id}" | ||
end |