Skip to content

Commit

Permalink
Resource calculate extent (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
kdimopulu authored and blacksmith-welder committed Dec 24, 2024
1 parent e2a07ed commit fe6d90c
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 5 deletions.
1 change: 1 addition & 0 deletions helpers/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ def create_resource(uuid)

fill_in 'resource_extents__0__number_', with: '10'
select 'Cassettes', from: 'resource_extents__0__extent_type_'
@resource_number_of_extents = 1

element = find('#resource_finding_aid_language_')
element.send_keys('ENG')
Expand Down
6 changes: 3 additions & 3 deletions staff_features/accessions/accession_calculate_extent.feature
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ Feature: Calculate Extent of an accession
And the user clicks on 'Save'
Then the 'Accession' updated message is displayed
And a new Extent is added to the Accession with the following values
| Portion | Whole |
| Number | 123456789 |
| Type | Cassettes |
| Portion | Whole |
| Number | 123456789 |
| Type | Cassettes |
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,10 @@

expect(extents.length).to eq @accession_number_of_extents + 1

created_extend = extents.last
created_extent = extents.last

form_values_hash = form_values_table.rows_hash
form_values_hash.each do |field, value|
expect(created_extend.find_field(field).value).to eq value.downcase.gsub(' ', '_')
expect(created_extent.find_field(field).value).to eq value.downcase.gsub(' ', '_')
end
end
18 changes: 18 additions & 0 deletions staff_features/resources/resource_calculate_extent.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Feature: Calculate Extent of a resource
Background:
Given an administrator user is logged in
And a Resource has been created
And the Resource is opened in edit mode
Scenario: Extent sub record is added to the Resource
When the user clicks on 'More'
And the user clicks on 'Calculate Extent'
And the user selects 'Whole' from 'Portion' in the modal
And the user fills in 'Number' with '123456789' in the modal
And the user selects 'Cassettes' from 'Type' in the modal
And the user clicks on 'Create Extent' in the modal
And the user clicks on 'Save'
Then the 'Resource' updated message is displayed
And a new Extent is added to the Resource with the following values
| Portion | Whole |
| Number | 123456789 |
| Type | Cassettes |
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# frozen_string_literal: true

Then 'a new Extent is added to the Resource with the following values' do |form_values_table|
extents = all('#resource_extents_ .subrecord-form-list li')

expect(extents.length).to eq @resource_number_of_extents + 1

created_extent = extents.last

form_values_hash = form_values_table.rows_hash
form_values_hash.each do |field, value|
expect(created_extent.find_field(field).value).to eq value.downcase.gsub(' ', '_')
end
end

0 comments on commit fe6d90c

Please sign in to comment.