-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
422309f
commit 19b2cf9
Showing
4 changed files
with
83 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,3 +23,6 @@ Style/ConditionalAssignment: | |
|
||
Style/NumericPredicate: | ||
Enabled: false | ||
|
||
Style/ZeroLengthPredicate: | ||
Enabled: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 8 additions & 7 deletions
15
staff_features/resources/resource_edit_default_values.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,20 @@ | ||
Feature: Resource Edit Default Values | ||
Background: | ||
Given an administrator user is logged in | ||
And the Pre-populate Records option is activated to My Repository Preferences | ||
And the Pre-populate Records option is checked in Repository Preferences | ||
And a Resource has been created | ||
And the user is on the Resources page | ||
Scenario: Open Resource Edit Default values page | ||
When the user clicks on 'Edit Default Values' | ||
And the user clicks on 'Resources' in the dropdown | ||
Then the 'Resource Record Defaults' page is displayed | ||
And the user clicks on 'Resource' in the dropdown menu | ||
Then the Resource Record Defaults page is displayed | ||
Scenario: Edit Default Values | ||
Given the user is on the Resource Record Default page | ||
When the user fills in 'Title' with 'Test Title' | ||
When the user fills in 'Title' with 'Default Test Title' | ||
And the user selects 'File' from 'Level of Description' | ||
And the user clicks on 'Save' | ||
Then the 'Defaults' updated message is displayed | ||
And the new Resource form has the following values | ||
| Title | Test Title | | ||
| Level of Description | File | | ||
And the new Resource form has the following default values | ||
| form_section | form_field | form_value | | ||
| Basic Information | Title | Default Test Title | | ||
| Basic Information | Level of Description | File | |
69 changes: 69 additions & 0 deletions
69
staff_features/resources/step_definitions/resource_edit_default_values.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
# frozen_string_literal: true | ||
|
||
Given 'the Pre-populate Records option is checked in Repository Preferences' do | ||
visit "#{STAFF_URL}/repositories/new" | ||
|
||
fill_in 'repository_repository__repo_code_', with: 'repository_test_resource_edit_default_values' | ||
fill_in 'repository_repository__name_', with: 'Repository Test Resource Edit Default Values' | ||
find('#repository_repository__publish_').check | ||
click_on 'Save' | ||
|
||
message = find('.alert') | ||
|
||
# Attempting to create a repository with the values above, | ||
# may result in a success message or one of the following errors. | ||
repository_exists = message.text == 'Repository Short Name - The repository short name must be unique within this ArchivesSpace' | ||
repository_created = message.text == 'Repository Created' | ||
agent_records_message = message.text == 'Agent records cannot be identical' | ||
expect(repository_exists || repository_created || agent_records_message).to eq true | ||
|
||
visit STAFF_URL | ||
|
||
click_on 'Select Repository' | ||
within '.dropdown-menu' do | ||
find('select').select 'repository_test_resource_edit_default_values' | ||
|
||
click_on 'Select Repository' | ||
end | ||
|
||
expect(page).to have_text 'The Repository repository_test_resource_edit_default_values is now active' | ||
|
||
find('#user-menu-dropdown').click | ||
within '.dropdown-menu' do | ||
click_on 'Repository Preferences (admin)' | ||
end | ||
|
||
find('#preference_defaults__default_values_').check | ||
|
||
click_on 'Save' | ||
end | ||
|
||
Given 'the user is on the Resources page' do | ||
visit "#{STAFF_URL}/resources" | ||
end | ||
|
||
Then 'the Resource Record Defaults page is displayed' do | ||
expect(current_url).to include 'resources/defaults' | ||
end | ||
|
||
Given 'the user is on the Resource Record Default page' do | ||
visit "#{STAFF_URL}/resources/defaults" | ||
end | ||
|
||
Then 'the new Resource form has the following default values' do |form_values_table| | ||
visit "#{STAFF_URL}/resources/new" | ||
|
||
form_values = form_values_table.hashes | ||
|
||
form_values.each do |row| | ||
section_title = find('h3', text: row['form_section']) | ||
section = section_title.ancestor('section') | ||
expect(section[:id]).to_not eq nil | ||
|
||
within section do | ||
field = find_field(row['form_field']) | ||
|
||
expect(field.value.downcase).to eq row['form_value'].downcase | ||
end | ||
end | ||
end |