Skip to content

Commit

Permalink
Ensure accession is deleted
Browse files Browse the repository at this point in the history
  • Loading branch information
blacksmith-welder committed Sep 18, 2024
1 parent a920004 commit 49217c9
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions staff_features/accessions/accession_delete.feature
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Feature: Accession Delete
And the user clicks on 'Delete' in the confirm popup
Then the Accessions page is displayed
And the 'Accession deleted' message is displayed
And the Accession is deleted
Scenario: Cancel Accession delete from the view page
Given the user is on the Accession view page
When the user clicks on 'Delete'
Expand Down
25 changes: 25 additions & 0 deletions staff_features/accessions/step_definitions/accession_delete.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@
within table_row do
click_on 'View'
end

input = find('input#uri')
expect(input.value).to include 'repositories'
expect(input.value).to include 'accession'

@accession_id = input.value.split('/').pop
end

When 'the user filters by text with the Accession title' do
Expand All @@ -39,6 +45,16 @@

When 'the user checks the checkbox of the Accession' do
find('#multiselect-item').check

within '#tabledSearchResults' do
row = find('tr.selected')

input = row.find('input')
expect(input.value).to include 'repositories'
expect(input.value).to include 'accession'

@accession_id = input.value.split('/').pop
end
end

When 'the user confirms the delete action' do
Expand All @@ -54,3 +70,12 @@
Then 'the Accessions page is displayed' do
expect(find('h2').text).to have_text 'Accessions'
end

Then 'the Accession is deleted' do
expect(@accession_id).to_not eq nil

visit "#{STAFF_URL}/accessions/#{@accession_id}/edit"

expect(find('h2').text).to eq 'Record Not Found'
expect(page).to have_text "The record you've tried to access may no longer exist or you may not have permission to view it."
end

0 comments on commit 49217c9

Please sign in to comment.