Skip to content

Commit

Permalink
Resource unpublish
Browse files Browse the repository at this point in the history
  • Loading branch information
blacksmith-welder committed Dec 24, 2024
1 parent 4d19cfa commit 7b8c732
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 21 deletions.
6 changes: 0 additions & 6 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ AllCops:
Metrics/AbcSize:
Max: 50

Metrics/BlockLength:
Max: 80

Layout/LineLength:
Max: 200

Expand All @@ -18,9 +15,6 @@ Metrics/MethodLength:
Metrics/BlockLength:
Max: 90

Layout/LineLength:
Max: 180

Layout/ElseAlignment:
Enabled: false

Expand Down
2 changes: 1 addition & 1 deletion helpers/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def create_resource(uuid)
find('#resource_publish_').check
select 'Class', from: 'resource_level_'
element = find('#resource_lang_materials__0__language_and_script__language_')
element.send_keys('AU')
element.send_keys(ORIGINAL_LANGUAGE)
element.send_keys(:tab)

select 'Single', from: 'resource_dates__0__date_type_'
Expand Down
1 change: 1 addition & 0 deletions helpers/original_values.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
ORIGINAL_ACCESSION_DATE = '2000-01-01'
ORIGINAL_ACCESSION_RIGHTS_STATEMENT_START_DATE = '2000-01-01'
ORIGINAL_RESOURCE_DATE = '2000-01-01'
ORIGINAL_LANGUAGE = 'Australian languages'
16 changes: 8 additions & 8 deletions staff_features/resources/resource_unpublish.feature
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
Feature: Resource Unpublish
Background:
Given an administrator user is logged in
And a Resource has been created
And the Resource is opened in edit mode
And a Resource has been created
And the Resource is opened in edit mode
Scenario: Unpublish the Resource record from toolbar
When the user clicks on 'Unpublish All'
And the user clicks on 'Unpublish All' in the confirm popup
Then the 'Resource' published message is displayed
When the user clicks on 'Unpublish All'
And the user clicks on 'Unpublish All' in the modal
Then the 'Resource' unpublished message is displayed
Scenario: Unpublish the Resource record from the Publish checkbox in the Basic Information section
When the user unchecks 'Publish'
And the user clicks on 'Save'
Then the 'Resource' updated message is displayed
When the user unchecks 'Publish'
And the user clicks on 'Save'
Then the 'Resource' updated message is displayed
6 changes: 1 addition & 5 deletions staff_features/resources/step_definitions/resource_edit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@
end
end

Given 'the Resource is opened in the view mode' do
visit "#{STAFF_URL}/resources/#{@resource_id}"
end

Given 'the Resource has one Language' do
languages = all('#resource_lang_materials_ .subrecord-form-list .subrecord-form-wrapper')

Expand Down Expand Up @@ -66,7 +62,7 @@
languages = all('#resource_lang_materials_ .subrecord-form-wrapper')

expect(languages.length).to eq 1
expect(find('#resource_lang_materials__0__language_and_script__language_').value).to eq 'Australian languages'
expect(find('#resource_lang_materials__0__language_and_script__language_').value).to eq ORIGINAL_LANGUAGE
end

Then 'the Resource does not have Notes' do
Expand Down
4 changes: 4 additions & 0 deletions staff_features/resources/step_definitions/resource_shared.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# frozen_string_literal: true

Given 'the Resource is opened in the view mode' do
visit "#{STAFF_URL}/resources/#{@resource_id}"
end

Given 'the Resource is opened in edit mode' do
visit "#{STAFF_URL}/resources/#{@resource_id}/edit"
wait_for_ajax
Expand Down
10 changes: 9 additions & 1 deletion staff_features/shared/step_definitions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,10 @@
check label, match: :first
end

When 'the user unchecks {string}' do |label|
uncheck label, match: :first
end

When 'the user changes the {string} field to {string}' do |field, value|
fill_in field, with: value, match: :first
end
Expand All @@ -223,7 +227,11 @@
end

Then('the {string} published message is displayed') do |string|
expect(find('.alert.alert-success.with-hide-alert').text).to match(/#{string} .* its subrecords and components have been published.*$/i)
expect(find('.alert.alert-success.with-hide-alert').text).to match(/#{string} .* subrecords and components have been published.*$/i)
end

Then('the {string} unpublished message is displayed') do |string|
expect(find('.alert.alert-success.with-hide-alert').text).to match(/#{string} .* subrecords and components have been unpublished.*$/i)
end

Then 'the following message is displayed' do |messages|
Expand Down

0 comments on commit 7b8c732

Please sign in to comment.