Skip to content

Commit 207ae21

Browse files
authored
Subject edit default values (#79)
1 parent 0550a6c commit 207ae21

File tree

3 files changed

+50
-0
lines changed

3 files changed

+50
-0
lines changed

staff_features/digital_objects/step_definitions/digital_object_shared.rb

+13
Original file line numberDiff line numberDiff line change
@@ -204,3 +204,16 @@
204204
And 'the user selects the Digital Object Component' do
205205
click_on "Digital Object Component Label #{@uuid}"
206206
end
207+
208+
Then 'the Assessment is linked to the Digital Object in the {string} form' do |form_title|
209+
section_title = find('h3', text: form_title)
210+
section = section_title.ancestor('section')
211+
expect(section[:id]).to_not eq nil
212+
213+
related_accessions_elements = section.all('li.token-input-token')
214+
215+
expect(related_accessions_elements.length).to eq 1
216+
related_accession = related_accessions_elements[0].find('.digital_object')
217+
218+
expect(related_accession[:'data-content']).to include "digital_objects/#{@digital_object_id}"
219+
end

staff_features/subjects/step_definitions/subject_shared.rb

+22
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,25 @@
55

66
wait_for_ajax
77
end
8+
9+
Given 'the user is on the Subjects page' do
10+
visit "#{STAFF_URL}/subjects"
11+
end
12+
13+
Then 'the new Subject form has the following default values' do |form_values_table|
14+
visit "#{STAFF_URL}/subjects/new"
15+
16+
form_values = form_values_table.hashes
17+
18+
form_values.each do |row|
19+
section_title = find('h3', text: row['form_section'])
20+
section = section_title.ancestor('section')
21+
expect(section[:id]).to_not eq nil
22+
23+
within section do
24+
field = find_field(row['form_field'])
25+
26+
expect(field.value.downcase).to eq row['form_value'].downcase
27+
end
28+
end
29+
end
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
Feature: Subject Edit Default Values
2+
Background:
3+
Given an administrator user is logged in
4+
And the Pre-populate Records option is checked in Repository Preferences
5+
And the user is on the Subjects page
6+
Scenario: Edit Default Values
7+
When the user clicks on 'Edit Default Values'
8+
And the user fills in 'Authority ID' with 'Test ID'
9+
And the user fills in 'Scope Note' with 'Text'
10+
And the user clicks on 'Save'
11+
Then the 'Defaults' updated message is displayed
12+
And the new Subject form has the following default values
13+
| form_section | form_field | form_value |
14+
| Basic Information | Authority ID | Test ID |
15+
| Basic Information | Scope Note | Text |

0 commit comments

Comments
 (0)