Skip to content

Commit

Permalink
Resource delete
Browse files Browse the repository at this point in the history
  • Loading branch information
blacksmith-welder committed Nov 20, 2024
1 parent 3653ef2 commit 69f1118
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 3 deletions.
3 changes: 0 additions & 3 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ Layout/LineLength:
Layout/ElseAlignment:
Enabled: false

Layout/LineLength:
Max: 174

Style/ConditionalAssignment:
Enabled: false

Expand Down
4 changes: 4 additions & 0 deletions helpers/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,10 @@ def create_resource(uuid)
find('button', text: 'Save Resource', match: :first).click

expect(page).to have_text "Resource Resource #{uuid} created"

url_parts = current_url.split('/')
url_parts.pop
@resource_id = url_parts.pop
end

def create_accession(uuid)
Expand Down
36 changes: 36 additions & 0 deletions staff_features/resources/step_definitions/resource_delete.rb
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

0 comments on commit 69f1118

Please sign in to comment.