Skip to content

Commit e87b8f3

Browse files
authored
Subject Delete (#76)
1 parent d8e6ab2 commit e87b8f3

File tree

2 files changed

+58
-0
lines changed

2 files changed

+58
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# frozen_string_literal: true
2+
3+
When 'the user checks the checkbox of the Subject' do
4+
find('#multiselect-item').check
5+
row = find('tr.selected')
6+
input = row.find('input')
7+
expect(input.value).to include 'subjects'
8+
9+
@subject_id = input.value.split('/').pop
10+
end
11+
12+
Then 'the Subject is deleted' do
13+
expect(@subject_id).to_not eq nil
14+
15+
visit "#{STAFF_URL}/subjects/#{@subject_id}/edit"
16+
17+
expect(find('h2').text).to eq 'Record Not Found'
18+
19+
expected_text = "The record you've tried to access may no longer exist or you may not have permission to view it."
20+
expect(page).to have_text expected_text
21+
end
22+
23+
Given('the user is on the Subject view page') do
24+
visit "#{STAFF_URL}/subjects/#{@subject_id}"
25+
end
26+
27+
Then 'the user is still on the Subject view page' do
28+
expect(find('h2').text).to eq "subject_term_#{@uuid} Subject"
29+
end
30+
31+
Then 'the Subjects page is displayed' do
32+
expect(find('h2').text).to have_text 'Subjects'
33+
end
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
Feature: Subject Delete
2+
Background:
3+
Given an administrator user is logged in
4+
And a Subject has been created
5+
Scenario: Subject is deleted from the search results
6+
When the user clicks on 'Browse'
7+
And the user clicks on 'Subjects'
8+
And the user filters by text with the Subject term
9+
And the user checks the checkbox of the Subject
10+
And the user clicks on 'Delete'
11+
And the user clicks on 'Delete Records'
12+
Then the 'Subjects' deleted message is displayed
13+
And the Subject is deleted
14+
Scenario: Subject is deleted from the view page
15+
Given the user is on the Subject view page
16+
When the user clicks on 'Delete'
17+
And the user clicks on 'Delete' in the modal
18+
Then the Subjects page is displayed
19+
And the 'Subject' deleted message is displayed
20+
And the Subject is deleted
21+
Scenario: Cancel Subject delete from the view page
22+
Given the user is on the Subject view page
23+
When the user clicks on 'Delete'
24+
And the user clicks on 'Cancel'
25+
Then the user is still on the Subject view page

0 commit comments

Comments
 (0)