diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index 4787862f5..0ac97531d 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -2,35 +2,35 @@ name: CI on: push: - branches: [ master ] + branches: [master] pull_request: - branches: [ master ] + branches: [master] jobs: tests: runs-on: ubuntu-latest strategy: matrix: - ruby: ['3.1', '3.2'] + ruby: ["3.2", "3.3"] steps: - - uses: actions/checkout@v3 - - name: Set up Ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: ${{ matrix.ruby }} - - uses: actions/cache@v3 - with: - path: vendor/bundle - key: ${{ runner.os }}-gems-202103-${{ hashFiles('**/Gemfile.lock') }} - restore-keys: | - ${{ runner.os }}-gems-202103 - - name: Bundle install - run: bundle config path vendor/bundle - - name: Use sidekiq pro - env: - BUNDLE_GEMS__CONTRIBSYS__COM: ${{ secrets.BUNDLE_GEMS__CONTRIBSYS__COM }} - run: bundle config --local gems.contribsys.com ${BUNDLE_GEMS__CONTRIBSYS__COM} - - name: Install dependencies - run: bin/setup && bin/rails db:test:prepare - - name: Run tests - run: bundle exec rake + - uses: actions/checkout@v3 + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + - uses: actions/cache@v3 + with: + path: vendor/bundle + key: ${{ runner.os }}-gems-202103-${{ hashFiles('**/Gemfile.lock') }} + restore-keys: | + ${{ runner.os }}-gems-202103 + - name: Bundle install + run: bundle config path vendor/bundle + - name: Use sidekiq pro + env: + BUNDLE_GEMS__CONTRIBSYS__COM: ${{ secrets.BUNDLE_GEMS__CONTRIBSYS__COM }} + run: bundle config --local gems.contribsys.com ${BUNDLE_GEMS__CONTRIBSYS__COM} + - name: Install dependencies + run: bin/setup && bin/rails db:test:prepare + - name: Run tests + run: bundle exec rake diff --git a/.rubocop.yml b/.rubocop.yml index 47cbe1f9e..572d2acc1 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -6,14 +6,14 @@ require: - rubocop-rails AllCops: - TargetRubyVersion: 2.7 + TargetRubyVersion: 3.2 DisplayCopNames: true Exclude: - - 'bin/**/*' - - 'db/**/*' - - 'config/**/*' - - 'vendor/**/*' - - 'spec/fixtures/**/*' + - "bin/**/*" + - "db/**/*" + - "config/**/*" + - "vendor/**/*" + - "spec/fixtures/**/*" Rails: Enabled: true @@ -21,17 +21,17 @@ Rails: Layout/LineLength: Max: 120 Exclude: - - 'app/controllers/concerns/search_across_blacklight_overrides.rb' - - 'app/models/spotlight/dor/indexer.rb' - - 'lib/traject/dor_config.rb' - - 'spec/features/indexing_integration_spec.rb' - - 'spec/models/spotlight/dor/indexer_spec.rb' - - 'spec/features/bibliography_formatting_spec.rb' + - "app/controllers/concerns/search_across_blacklight_overrides.rb" + - "app/models/spotlight/dor/indexer.rb" + - "lib/traject/dor_config.rb" + - "spec/features/indexing_integration_spec.rb" + - "spec/models/spotlight/dor/indexer_spec.rb" + - "spec/features/bibliography_formatting_spec.rb" Style/PercentLiteralDelimiters: PreferredDelimiters: - '%i': '()' - '%w': '()' + "%i": "()" + "%w": "()" Style/StringLiterals: Enabled: true @@ -51,7 +51,7 @@ Style/HashTransformValues: Metrics/ClassLength: Exclude: - - 'app/controllers/catalog_controller.rb' + - "app/controllers/catalog_controller.rb" RSpec/Capybara: Enabled: false @@ -68,21 +68,21 @@ Bundler/OrderedGems: RSpec/ExampleLength: Max: 10 Exclude: - - 'spec/features/indexing_integration_spec.rb' + - "spec/features/indexing_integration_spec.rb" RSpec/MultipleMemoizedHelpers: Enabled: false Metrics/BlockLength: Exclude: - - 'app/controllers/catalog_controller.rb' - - 'app/controllers/search_across_controller.rb' - - 'app/models/spotlight/dor/indexer.rb' - - 'spec/**/*' + - "app/controllers/catalog_controller.rb" + - "app/controllers/search_across_controller.rb" + - "app/models/spotlight/dor/indexer.rb" + - "spec/**/*" Performance/RedundantBlockCall: Exclude: - - 'lib/traject/macros/**/*' + - "lib/traject/macros/**/*" Layout/EmptyLinesAroundAttributeAccessor: Enabled: true Layout/SpaceAroundMethodCallOperator: diff --git a/Gemfile.lock b/Gemfile.lock index 1f7777f92..5e005bc75 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -463,6 +463,8 @@ GEM net-ssh (7.2.3) newrelic_rpm (9.8.0) nio4r (2.7.1) + nokogiri (1.16.4-arm64-darwin) + racc (~> 1.4) nokogiri (1.16.4-x86_64-darwin) racc (~> 1.4) nokogiri (1.16.4-x86_64-linux) @@ -710,6 +712,7 @@ GEM actionpack (>= 5.2) activesupport (>= 5.2) sprockets (>= 3.0.0) + sqlite3 (1.7.3-arm64-darwin) sqlite3 (1.7.3-x86_64-darwin) sqlite3 (1.7.3-x86_64-linux) sshkit (1.22.1) @@ -795,6 +798,7 @@ GEM zeitwerk (2.6.13) PLATFORMS + arm64-darwin-23 x86_64-darwin-19 x86_64-darwin-20 x86_64-darwin-21 diff --git a/app/controllers/concerns/search_across_blacklight_overrides.rb b/app/controllers/concerns/search_across_blacklight_overrides.rb index b1916fe4a..75b7630e4 100644 --- a/app/controllers/concerns/search_across_blacklight_overrides.rb +++ b/app/controllers/concerns/search_across_blacklight_overrides.rb @@ -64,8 +64,8 @@ def render_grouped_document_index(response = @response) view_context.render_document_index(exhibits) end - def opensearch_catalog_url(*args) - view_context.spotlight.opensearch_search_across_url(*args) + def opensearch_catalog_url(*) + view_context.spotlight.opensearch_search_across_url(*) end def start_over_path(*_args) @@ -107,11 +107,11 @@ def page_entries_info(collection, entry_name: nil) case collection.total_count when 0 - t('search_across.pagination_info.no_items_found', entry_name: entry_name).html_safe + t('search_across.pagination_info.no_items_found', entry_name:).html_safe when 1 - t('search_across.pagination_info.single_item_found', entry_name: entry_name).html_safe + t('search_across.pagination_info.single_item_found', entry_name:).html_safe else - t('search_across.pagination_info.pages', entry_name: entry_name, + t('search_across.pagination_info.pages', entry_name:, current_page: collection.current_page, num_pages: collection.total_pages, start_num: view_context.number_with_delimiter(collection.offset_value + 1), diff --git a/app/controllers/spotlight/exhibits_controller.rb b/app/controllers/spotlight/exhibits_controller.rb index ebf4bd676..75167c2a5 100644 --- a/app/controllers/spotlight/exhibits_controller.rb +++ b/app/controllers/spotlight/exhibits_controller.rb @@ -7,8 +7,8 @@ module Spotlight # Override the upstream HomePagesController in order to inject range limit behaviors class ExhibitsController - def search_action_url(*args) - main_app.search_search_across_url(*args) + def search_action_url(*) + main_app.search_search_across_url(*) end def blacklight_config diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 8ae1c05f3..91749a867 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -19,9 +19,9 @@ def document_leaflet_map(document:, **) ## # @param [String] manifest def iiif_drag_n_drop(manifest, width: '40') - link_url = format Settings.iiif_dnd_base_url, query: { manifest: manifest }.to_query + link_url = format Settings.iiif_dnd_base_url, query: { manifest: }.to_query link_to link_url, class: 'iiif-dnd float-right', data: { turbolinks: false } do - image_tag 'iiif-drag-n-drop.svg', width: width, alt: 'IIIF Drag-n-drop' + image_tag 'iiif-drag-n-drop.svg', width:, alt: 'IIIF Drag-n-drop' end end @@ -36,10 +36,10 @@ def render_viewer_in_context(document, block) canvas = choose_canvas_id(block) if params[:controller] == 'spotlight/catalog' render partial: current_exhibit.required_viewer.to_partial_path, - locals: { document: document, block: block, canvas: canvas } + locals: { document:, block:, canvas: } else render partial: current_exhibit.required_viewer.default_viewer_path, - locals: { document: document, block: block, canvas: canvas } + locals: { document:, block:, canvas: } end end @@ -52,8 +52,8 @@ def custom_render_oembed_tag_async(document, canvas_id, block) content_tag :div, '', data: { embed_url: blacklight_oembed_engine.embed_url( - url: url, - canvas_id: canvas_id, + url:, + canvas_id:, search: params[:search], maxheight: block&.maxheight.presence || '600', suggested_search: (current_search_session&.query_params || {})[:q] diff --git a/app/helpers/catalog_helper.rb b/app/helpers/catalog_helper.rb index 2b12c8164..ac4394a0a 100644 --- a/app/helpers/catalog_helper.rb +++ b/app/helpers/catalog_helper.rb @@ -67,7 +67,7 @@ def table_of_contents_separator(options = {}) contents = safe_join(contents.map { |v| "
stuff
) } @@ -116,7 +116,7 @@ describe '#manuscript_link' do let(:druid) { 'bg021sq9590' } - let(:input) { { value: [druid], document: document } } + let(:input) { { value: [druid], document: } } let(:show_page) { "/test-flag-exhibit-slug/catalog/#{druid}" } before do @@ -169,7 +169,7 @@ def current_exhibit end it 'wraps each highlight value in a paragraph tag' do - ps = helper.render_fulltext_highlight(document: document) + ps = helper.render_fulltext_highlight(document:) expect(ps).to eq 'The first Value1
The Value2 second
' end end @@ -180,7 +180,7 @@ def current_exhibit end it 'only renders the configured amount of snippets' do - ps = helper.render_fulltext_highlight(document: document) + ps = helper.render_fulltext_highlight(document:) expect(ps.scan('').count).to eq Settings.full_text_highlight.snippet_count end end @@ -193,7 +193,7 @@ def current_exhibit it 'offers a link to go the record view w/ a search initiated' do expect(helper).to receive_messages(current_exhibit: {}, params: { q: 'The search term' }) - link = Capybara.string(helper.render_fulltext_highlight(document: document)).find('a') + link = Capybara.string(helper.render_fulltext_highlight(document:)).find('a') expect(link.text).to eq('Search for "The search term" in document text') expect(link['href']).to match(/abc123\?search=The\+search\+term/) end @@ -203,7 +203,7 @@ def current_exhibit let(:highlights) { [] } it 'is nil' do - ps = helper.render_fulltext_highlight(document: document) + ps = helper.render_fulltext_highlight(document:) expect(ps).to be_blank end end diff --git a/spec/helpers/search_across_helper_spec.rb b/spec/helpers/search_across_helper_spec.rb index 66b2252d3..784230ebe 100644 --- a/spec/helpers/search_across_helper_spec.rb +++ b/spec/helpers/search_across_helper_spec.rb @@ -13,7 +13,7 @@ it 'removes the group key/value' do expect(helper).to receive_messages( - search_state: search_state + search_state: ) expect(helper.search_without_group).to eq({}) end @@ -29,7 +29,7 @@ it 'removes the group key/value' do expect(helper).to receive_messages( - search_state: search_state + search_state: ) expect(helper.search_with_group).to eq group: true end @@ -89,7 +89,7 @@ let(:current_ability) { Ability.new(User.new) } before do - assign(:response, Blacklight::Solr::Response.new(response, nil, blacklight_config: blacklight_config)) + assign(:response, Blacklight::Solr::Response.new(response, nil, blacklight_config:)) allow(helper).to receive(:current_ability).and_return(current_ability) create(:exhibit, slug: 'abc', title: 'Alphabet') @@ -136,7 +136,7 @@ let(:current_ability) { Ability.new(User.new) } before do - assign(:response, Blacklight::Solr::Response.new(response, nil, blacklight_config: blacklight_config)) + assign(:response, Blacklight::Solr::Response.new(response, nil, blacklight_config:)) allow(helper).to receive(:current_ability).and_return(current_ability) create(:exhibit, slug: 'a', title: 'Alphabet') @@ -168,7 +168,7 @@ let(:current_ability) { Ability.new(User.new) } before do - assign(:response, Blacklight::Solr::Response.new(response, nil, blacklight_config: blacklight_config)) + assign(:response, Blacklight::Solr::Response.new(response, nil, blacklight_config:)) create(:exhibit, slug: 'abc') create(:exhibit, slug: 'xyz') create(:exhibit, slug: 'private', published: false) diff --git a/spec/jobs/index_exhibit_metadata_job_spec.rb b/spec/jobs/index_exhibit_metadata_job_spec.rb index 2d4009013..3505add2d 100644 --- a/spec/jobs/index_exhibit_metadata_job_spec.rb +++ b/spec/jobs/index_exhibit_metadata_job_spec.rb @@ -12,7 +12,7 @@ context 'when the action is add' do it 'sends the add message to the ExhibitIndexer' do - subject.perform(exhibit: exhibit, action: 'add') + subject.perform(exhibit:, action: 'add') expect(indexer).to have_received(:add) end @@ -20,7 +20,7 @@ context 'when the action is delete' do it 'sends the delete message to the ExhibitIndexer' do - subject.perform(exhibit: exhibit, action: 'delete') + subject.perform(exhibit:, action: 'delete') expect(indexer).to have_received(:delete) end diff --git a/spec/jobs/index_related_content_job_spec.rb b/spec/jobs/index_related_content_job_spec.rb index 05a3d9d33..83b67b3a6 100644 --- a/spec/jobs/index_related_content_job_spec.rb +++ b/spec/jobs/index_related_content_job_spec.rb @@ -5,7 +5,7 @@ RSpec.describe IndexRelatedContentJob do describe '#perform' do let(:exhibit) { create(:exhibit) } - let(:harvester) { DorHarvester.new(exhibit: exhibit) } + let(:harvester) { DorHarvester.new(exhibit:) } let(:enqueuer) { instance_double(IiifCanvasIndexer, index_canvases: []) } it do diff --git a/spec/jobs/record_index_status_job_spec.rb b/spec/jobs/record_index_status_job_spec.rb index d909fe562..e4620c342 100644 --- a/spec/jobs/record_index_status_job_spec.rb +++ b/spec/jobs/record_index_status_job_spec.rb @@ -5,7 +5,7 @@ RSpec.describe RecordIndexStatusJob do describe '#perform' do let(:exhibit) { create(:exhibit) } - let(:harvester) { DorHarvester.new(exhibit: exhibit) } + let(:harvester) { DorHarvester.new(exhibit:) } it 'creates a new sidecar with a status entry' do expect do diff --git a/spec/jobs/send_publish_state_change_notification_job_spec.rb b/spec/jobs/send_publish_state_change_notification_job_spec.rb index a592215ed..81f7531b0 100644 --- a/spec/jobs/send_publish_state_change_notification_job_spec.rb +++ b/spec/jobs/send_publish_state_change_notification_job_spec.rb @@ -3,7 +3,7 @@ require 'rails_helper' describe SendPublishStateChangeNotificationJob do - let(:job) { described_class.perform_now(exhibit: exhibit, published: published) } + let(:job) { described_class.perform_now(exhibit:, published:) } let(:exhibit) { FactoryBot.create(:exhibit) } context 'when publishing' do diff --git a/spec/models/dor_harvester_spec.rb b/spec/models/dor_harvester_spec.rb index 94d4125e5..5d9f0ea11 100644 --- a/spec/models/dor_harvester_spec.rb +++ b/spec/models/dor_harvester_spec.rb @@ -3,7 +3,7 @@ require 'rails_helper' describe DorHarvester do - subject(:harvester) { described_class.create druid_list: druid, exhibit: exhibit } + subject(:harvester) { described_class.create druid_list: druid, exhibit: } let(:exhibit) { create(:exhibit) } let(:druid) { 'xf680rd3068' } @@ -65,7 +65,7 @@ end context 'when index_related_content is enabled for an exhibit' do - subject(:harvester) { described_class.create druid_list: druid, exhibit: exhibit } + subject(:harvester) { described_class.create druid_list: druid, exhibit: } let(:exhibit) { create(:exhibit, slug: 'test-flag-exhibit-slug') } @@ -132,7 +132,7 @@ def sidecar let(:items) { [] } let(:resource) do - instance_double(Purl, exists?: true, bare_druid: druid, items: items) + instance_double(Purl, exists?: true, bare_druid: druid, items:) end before do @@ -148,7 +148,7 @@ def sidecar context 'with a collection' do let(:items) { [child].each } # `#each` converts the array to an enumerable - let(:child) { instance_double(PurlFetcher::Client::PublicXmlRecord, druid: druid) } + let(:child) { instance_double(PurlFetcher::Client::PublicXmlRecord, druid:) } it 'includes child resources' do expect(subject.size).to eq 2 diff --git a/spec/models/exhibit_indexer_spec.rb b/spec/models/exhibit_indexer_spec.rb index 44328bf2b..b9a925795 100644 --- a/spec/models/exhibit_indexer_spec.rb +++ b/spec/models/exhibit_indexer_spec.rb @@ -9,7 +9,7 @@ let(:exhibit) { FactoryBot.create(:exhibit) } before do - allow(described_class).to receive_messages(solr_connection: solr_connection) + allow(described_class).to receive_messages(solr_connection:) end describe '#add' do diff --git a/spec/models/full_text_parser_spec.rb b/spec/models/full_text_parser_spec.rb index 08c08cd58..9dbbe7e34 100644 --- a/spec/models/full_text_parser_spec.rb +++ b/spec/models/full_text_parser_spec.rb @@ -5,7 +5,7 @@ describe FullTextParser do subject(:parser) { described_class.new(purl_object) } - let(:purl_object) { instance_double('PurlObject', bare_druid: 'cc842mn9348', public_xml: public_xml) } + let(:purl_object) { instance_double('PurlObject', bare_druid: 'cc842mn9348', public_xml:) } let(:public_xml) { Nokogiri::XML.parse(File.read(File.join(FIXTURES_PATH, 'cc842mn9348.xml'))) } describe '#ocr_files' do @@ -35,7 +35,7 @@ end context 'with an hOCR transcription' do - let(:purl_object) { instance_double('PurlObject', bare_druid: 'hocrexample', public_xml: public_xml) } + let(:purl_object) { instance_double('PurlObject', bare_druid: 'hocrexample', public_xml:) } let(:public_xml) { Nokogiri::XML.parse(File.read(File.join(FIXTURES_PATH, 'hocrexample.xml'))) } let(:text) do <<-FIXTURE @@ -64,7 +64,7 @@ end context 'with a plain-text transcription' do - let(:purl_object) { instance_double('PurlObject', bare_druid: 'xt162pg0437', public_xml: public_xml) } + let(:purl_object) { instance_double('PurlObject', bare_druid: 'xt162pg0437', public_xml:) } let(:public_xml) { Nokogiri::XML.parse(File.read(File.join(FIXTURES_PATH, 'xt162pg0437.xml'))) } before do diff --git a/spec/models/iiif_canvas_indexer_spec.rb b/spec/models/iiif_canvas_indexer_spec.rb index 049d59896..5e7603660 100644 --- a/spec/models/iiif_canvas_indexer_spec.rb +++ b/spec/models/iiif_canvas_indexer_spec.rb @@ -12,7 +12,7 @@ custom_manifest_pattern: 'http://example.org/iiif/{id}/manifest' ) end - let(:exhibit) { create(:exhibit, viewer: viewer) } + let(:exhibit) { create(:exhibit, viewer:) } let(:druid) { 'book1' } let(:document) do SolrDocument.new( diff --git a/spec/models/search_builder_spec.rb b/spec/models/search_builder_spec.rb index bf61d51bb..a8b71bcf2 100644 --- a/spec/models/search_builder_spec.rb +++ b/spec/models/search_builder_spec.rb @@ -7,13 +7,13 @@ let(:exhibit) { create(:exhibit) } let(:scope) do - instance_double('scope', blacklight_config: blacklight_config, current_exhibit: exhibit, search_state_class: nil) + instance_double('scope', blacklight_config:, current_exhibit: exhibit, search_state_class: nil) end let(:rows) { 999 } let(:blacklight_params) do { format: 'json', - rows: rows + rows: }.with_indifferent_access end let(:blacklight_config) do @@ -74,7 +74,7 @@ end context 'non-JSON API is over limit' do - let(:blacklight_params) { { q: 'my query', rows: rows }.with_indifferent_access } # omit format + let(:blacklight_params) { { q: 'my query', rows: }.with_indifferent_access } # omit format it 'cannot exceed config.max_per_page' do expect(builder.to_hash).to include(rows: 100) diff --git a/spec/models/spotlight/exhibit_spec.rb b/spec/models/spotlight/exhibit_spec.rb index bed5ea49e..93bd8bbfa 100644 --- a/spec/models/spotlight/exhibit_spec.rb +++ b/spec/models/spotlight/exhibit_spec.rb @@ -73,7 +73,7 @@ expect do exhibit.save - end.to have_enqueued_job(IndexExhibitMetadataJob).with(exhibit: exhibit, action: 'add') + end.to have_enqueued_job(IndexExhibitMetadataJob).with(exhibit:, action: 'add') end end @@ -83,7 +83,7 @@ it 'enqueues the IndexExhibitMetadataJob for adding a document' do expect do exhibit.save - end.to have_enqueued_job(IndexExhibitMetadataJob).with(exhibit: exhibit, action: 'add') + end.to have_enqueued_job(IndexExhibitMetadataJob).with(exhibit:, action: 'add') end end @@ -95,7 +95,7 @@ expect do exhibit.save - end.to have_enqueued_job(IndexExhibitMetadataJob).with(exhibit: exhibit, action: 'delete') + end.to have_enqueued_job(IndexExhibitMetadataJob).with(exhibit:, action: 'delete') end end diff --git a/spec/models/spotlight/resources/iiif_manifest_spec.rb b/spec/models/spotlight/resources/iiif_manifest_spec.rb index 6f342cd2c..3e23ebf1a 100644 --- a/spec/models/spotlight/resources/iiif_manifest_spec.rb +++ b/spec/models/spotlight/resources/iiif_manifest_spec.rb @@ -21,7 +21,7 @@ it 'adds in the exhibits custom field thumbnail_square_url_ssm' do expect(iiif_manifest_resource).to receive_messages( thumbnail_field: 'thumbnail_field', - manifest: manifest + manifest: ) iiif_manifest_resource.add_thumbnail_url @@ -62,7 +62,7 @@ it 'uses the first canvas as a thumbnail' do expect(iiif_manifest_resource).to receive_messages( thumbnail_field: 'thumbnail_field', - manifest: manifest + manifest: ) iiif_manifest_resource.add_thumbnail_url diff --git a/spec/models/spotlight/resources/upload_spec.rb b/spec/models/spotlight/resources/upload_spec.rb index fa4d4463b..7e9a7eed0 100644 --- a/spec/models/spotlight/resources/upload_spec.rb +++ b/spec/models/spotlight/resources/upload_spec.rb @@ -3,7 +3,7 @@ require 'rails_helper' describe Spotlight::Resources::Upload do - subject(:resource) { described_class.create! exhibit: exhibit, upload: upload } + subject(:resource) { described_class.create! exhibit:, upload: } let(:exhibit) { create(:exhibit) } let(:upload_id) { 123 } diff --git a/spec/requests/index_statuses_requests_spec.rb b/spec/requests/index_statuses_requests_spec.rb index 7ae4ebf54..dde458c3e 100644 --- a/spec/requests/index_statuses_requests_spec.rb +++ b/spec/requests/index_statuses_requests_spec.rb @@ -5,15 +5,15 @@ describe 'Index Statuses', type: :request do let(:exhibit) { create(:exhibit) } let(:user) { nil } - let(:resource) { DorHarvester.create(exhibit: exhibit) } + let(:resource) { DorHarvester.create(exhibit:) } before do sign_in user 5.times do |i| Spotlight::SolrDocumentSidecar.create( - exhibit: exhibit, - resource: resource, + exhibit:, + resource:, document: SolrDocument.new(id: "abc#{i}"), index_status: { ok: true } ) @@ -21,7 +21,7 @@ end context 'for an exhibit admin' do - let(:user) { create(:exhibit_admin, exhibit: exhibit) } + let(:user) { create(:exhibit_admin, exhibit:) } describe '#show' do it "renders json including details about the item's indexing status" do diff --git a/spec/requests/viewers_spec.rb b/spec/requests/viewers_spec.rb index 5c0a09147..59a89f2bf 100644 --- a/spec/requests/viewers_spec.rb +++ b/spec/requests/viewers_spec.rb @@ -32,7 +32,7 @@ end context 'an exhibit admin' do - let(:user) { create(:exhibit_admin, exhibit: exhibit) } + let(:user) { create(:exhibit_admin, exhibit:) } it 'is allowed' do get "/#{exhibit.slug}/viewers/edit" @@ -52,7 +52,7 @@ end context 'an exhibit admin' do - let(:user) { create(:exhibit_admin, exhibit: exhibit) } + let(:user) { create(:exhibit_admin, exhibit:) } let(:viewer_params) { { viewer_type: 'mirador' } } before do diff --git a/spec/services/search_across_search_builder_spec.rb b/spec/services/search_across_search_builder_spec.rb index 035830d97..8ad9db58e 100644 --- a/spec/services/search_across_search_builder_spec.rb +++ b/spec/services/search_across_search_builder_spec.rb @@ -7,11 +7,11 @@ let(:scope) do instance_double(Blacklight::SearchService, - blacklight_config: blacklight_config, - context: context, + blacklight_config:, + context:, search_state_class: nil) end - let(:context) { { current_ability: current_ability } } + let(:context) { { current_ability: } } let(:blacklight_config) { SearchAcrossController.blacklight_config.deep_copy } let(:user_params) { {} } let(:user) { create(:curator) } diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 16507cd52..3103ed1f1 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration -Dir['./spec/support/**/*.rb'].sort.each { |f| require f } +Dir['./spec/support/**/*.rb'].each { |f| require f } require 'webmock/rspec' allowed_sites = [ 'chromedriver.storage.googleapis.com', diff --git a/spec/support/etl_helper.rb b/spec/support/etl_helper.rb index 89c82747c..37e468b04 100644 --- a/spec/support/etl_helper.rb +++ b/spec/support/etl_helper.rb @@ -4,9 +4,9 @@ module EtlHelper # Helper method to get indexed documents for a resource def indexed_documents(resource, throw_as: :skip, on_error: :exception) - return to_enum(:indexed_documents, resource, throw_as: throw_as, on_error: :exception) unless block_given? + return to_enum(:indexed_documents, resource, throw_as:, on_error: :exception) unless block_given? - resource.reindex(on_error: on_error) do |data| + resource.reindex(on_error:) do |data| yield data throw throw_as if throw_as end diff --git a/spec/views/catalog/_embedded_mirador3.html.erb_spec.rb b/spec/views/catalog/_embedded_mirador3.html.erb_spec.rb index ec8ca99fc..88c2ad2db 100644 --- a/spec/views/catalog/_embedded_mirador3.html.erb_spec.rb +++ b/spec/views/catalog/_embedded_mirador3.html.erb_spec.rb @@ -9,7 +9,7 @@ before do without_partial_double_verification do allow(view).to receive_messages( - document: document + document: ) end end diff --git a/spec/views/catalog/_exhibits_document_header_default.html.erb_spec.rb b/spec/views/catalog/_exhibits_document_header_default.html.erb_spec.rb index 58a0ec439..e7d1925d6 100644 --- a/spec/views/catalog/_exhibits_document_header_default.html.erb_spec.rb +++ b/spec/views/catalog/_exhibits_document_header_default.html.erb_spec.rb @@ -9,7 +9,7 @@ before do expect(view).to receive_messages( current_exhibit: exhibit, - document: document, + document:, document_counter: 0, render_document_partial: -> {} ) diff --git a/spec/views/catalog/_metadata_button_default.html.erb_spec.rb b/spec/views/catalog/_metadata_button_default.html.erb_spec.rb index f510e9a4a..7c4f7f63f 100644 --- a/spec/views/catalog/_metadata_button_default.html.erb_spec.rb +++ b/spec/views/catalog/_metadata_button_default.html.erb_spec.rb @@ -12,7 +12,7 @@ context 'when modsxml is available' do it do - expect(view).to receive_messages(current_exhibit: current_exhibit) + expect(view).to receive_messages(current_exhibit:) render expect(rendered).to have_css 'a', text: 'More details ยป' end diff --git a/spec/views/dor_harvester/_status.html.erb_spec.rb b/spec/views/dor_harvester/_status.html.erb_spec.rb index 93244fdcf..ce48f9fb8 100644 --- a/spec/views/dor_harvester/_status.html.erb_spec.rb +++ b/spec/views/dor_harvester/_status.html.erb_spec.rb @@ -4,7 +4,7 @@ RSpec.describe 'dor_harvester/_status.html.erb', type: :view do let(:exhibit) { create(:exhibit) } - let(:harvester) { DorHarvester.new(druid_list: '', exhibit: exhibit) } + let(:harvester) { DorHarvester.new(druid_list: '', exhibit:) } context 'with status information' do before do @@ -14,14 +14,14 @@ end it 'displays the object status' do - render partial: 'dor_harvester/status', locals: { harvester: harvester } + render partial: 'dor_harvester/status', locals: { harvester: } expect(rendered).to have_content('Object druids') expect(rendered).to have_content(/okdruid\s+Published/) expect(rendered).to have_selector '.danger', text: /baddruid\s+broken/ end it 'displays the collection status' do - render partial: 'dor_harvester/status', locals: { harvester: harvester } + render partial: 'dor_harvester/status', locals: { harvester: } expect(rendered).to have_content('Collection druids') expect(rendered).to have_content(/collectiondruid\s+52/) end @@ -29,7 +29,7 @@ context 'without status information' do it 'displays an empty status' do - render partial: 'dor_harvester/status', locals: { harvester: harvester } + render partial: 'dor_harvester/status', locals: { harvester: } expect(rendered).not_to have_selector '#sdr-status-inner-items' expect(rendered).not_to have_selector '#sdr-status-inner-collections' end