Skip to content

Commit

Permalink
Subject delete
Browse files Browse the repository at this point in the history
  • Loading branch information
blacksmith-welder committed Jan 22, 2025
1 parent 4d828b9 commit 8b81b4b
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
33 changes: 33 additions & 0 deletions staff_features/subjects/step_definitions/subject_delete.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# frozen_string_literal: true

When 'the user checks the checkbox of the Subject' do
find('#multiselect-item').check
row = find('tr.selected')
input = row.find('input')
expect(input.value).to include 'subjects'

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

Then 'the Subject is deleted' do
expect(@subject_id).to_not eq nil

visit "#{STAFF_URL}/subjects/#{@subject_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

Given('the user is on the Subject view page') do
visit "#{STAFF_URL}/subjects/#{@subject_id}"
end

Then 'the user is still on the Subject view page' do
expect(find('h2').text).to eq "subject_term_#{@uuid} Subject"
end

Then 'the Subjects page is displayed' do
expect(find('h2').text).to have_text 'Subjects'
end
2 changes: 1 addition & 1 deletion staff_features/subjects/subject_delete.feature
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Feature: Subject Delete
And the user checks the checkbox of the Subject
And the user clicks on 'Delete'
And the user clicks on 'Delete Records'
Then the 'Records' deleted message is displayed
Then the 'Subjects' deleted message is displayed
And the Subject is deleted
Scenario: Subject is deleted from the view page
Given the user is on the Subject view page
Expand Down

0 comments on commit 8b81b4b

Please sign in to comment.