From cbb64f772eff6973a18847bef870c84ff144fdb5 Mon Sep 17 00:00:00 2001 From: Justin Coyne Date: Wed, 22 Jan 2025 10:17:40 -0600 Subject: [PATCH] Disable rspec monkeypatching --- spec/controllers/application_controller_spec.rb | 2 +- spec/controllers/login_controller_spec.rb | 2 +- spec/controllers/spotlight/catalog_controller_spec.rb | 2 +- .../controllers/spotlight/contact_forms_controller_spec.rb | 2 +- spec/features/alt_text_instructions_spec.rb | 2 +- spec/features/browse_category_admin_spec.rb | 2 +- spec/features/canvas_display_spec.rb | 2 +- spec/features/exhibit_index_spec.rb | 2 +- spec/features/exhibit_spec.rb | 2 +- spec/helpers/application_helper_spec.rb | 2 +- spec/helpers/catalog_helper_spec.rb | 2 +- .../send_publish_state_change_notification_job_spec.rb | 2 +- spec/models/dor_harvester_spec.rb | 2 +- spec/models/exhibit_bot_spec.rb | 2 +- spec/models/feature_flags_spec.rb | 2 +- spec/models/full_text_parser_spec.rb | 2 +- spec/models/purl_spec.rb | 2 +- spec/models/solr_document_spec.rb | 2 +- spec/models/spotlight/exhibit_spec.rb | 2 +- spec/models/spotlight/resources/iiif_manifest_spec.rb | 2 +- spec/models/spotlight/resources/upload_spec.rb | 2 +- spec/models/user_spec.rb | 2 +- spec/models/viewer_spec.rb | 2 +- spec/requests/exhibit_finder_requests_spec.rb | 2 +- spec/requests/index_statuses_requests_spec.rb | 2 +- spec/requests/viewers_spec.rb | 2 +- spec/services/search_across_search_builder_spec.rb | 2 +- spec/spec_helper.rb | 7 +------ .../catalog/_bibliography_buttons_default.html.erb_spec.rb | 2 +- spec/views/catalog/_embedded_mirador3.html.erb_spec.rb | 2 +- .../catalog/_metadata_button_default.html.erb_spec.rb | 2 +- spec/views/viewers/edit.html.erb_spec.rb | 2 +- 32 files changed, 32 insertions(+), 37 deletions(-) diff --git a/spec/controllers/application_controller_spec.rb b/spec/controllers/application_controller_spec.rb index d12001cfa..b375b4e1a 100644 --- a/spec/controllers/application_controller_spec.rb +++ b/spec/controllers/application_controller_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -describe ApplicationController do +RSpec.describe ApplicationController do describe '#feature_flags' do before do allow(controller).to receive(:current_exhibit) diff --git a/spec/controllers/login_controller_spec.rb b/spec/controllers/login_controller_spec.rb index b49068cf0..6adb6f103 100644 --- a/spec/controllers/login_controller_spec.rb +++ b/spec/controllers/login_controller_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -describe LoginController do +RSpec.describe LoginController do let(:user) { create(:curator) } before do diff --git a/spec/controllers/spotlight/catalog_controller_spec.rb b/spec/controllers/spotlight/catalog_controller_spec.rb index 02b23a31b..333d60324 100644 --- a/spec/controllers/spotlight/catalog_controller_spec.rb +++ b/spec/controllers/spotlight/catalog_controller_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -describe Spotlight::CatalogController do +RSpec.describe Spotlight::CatalogController do include ActiveJob::TestHelper routes { Spotlight::Engine.routes } diff --git a/spec/controllers/spotlight/contact_forms_controller_spec.rb b/spec/controllers/spotlight/contact_forms_controller_spec.rb index b1137c21e..c5f16c7a3 100644 --- a/spec/controllers/spotlight/contact_forms_controller_spec.rb +++ b/spec/controllers/spotlight/contact_forms_controller_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -describe Spotlight::ContactFormsController do +RSpec.describe Spotlight::ContactFormsController do routes { Spotlight::Engine.routes } let(:exhibit) { create(:exhibit) } let(:honeypot_field_name) { Spotlight::Engine.config.spambot_honeypot_email_field } diff --git a/spec/features/alt_text_instructions_spec.rb b/spec/features/alt_text_instructions_spec.rb index dbf028056..4fc82ec7b 100644 --- a/spec/features/alt_text_instructions_spec.rb +++ b/spec/features/alt_text_instructions_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -describe 'Alt text instructions', :js do +RSpec.describe 'Alt text instructions', :js do include JavascriptFeatureHelpers let(:exhibit) { create(:exhibit) } diff --git a/spec/features/browse_category_admin_spec.rb b/spec/features/browse_category_admin_spec.rb index 125507ba7..2e9487c20 100644 --- a/spec/features/browse_category_admin_spec.rb +++ b/spec/features/browse_category_admin_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -describe 'Browse category adminstration', :js do +RSpec.describe 'Browse category adminstration', :js do let(:exhibit) { create(:exhibit) } let(:exhibit_curator) { create(:exhibit_curator, exhibit: exhibit) } let(:title) { 'New category title' } diff --git a/spec/features/canvas_display_spec.rb b/spec/features/canvas_display_spec.rb index f34a3d7bf..ea7edf168 100644 --- a/spec/features/canvas_display_spec.rb +++ b/spec/features/canvas_display_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -describe 'Canvas Display' do +RSpec.describe 'Canvas Display' do let(:exhibit) { create(:exhibit, slug: 'default-exhibit') } let(:canvas_data) { JSON.parse(File.read('spec/fixtures/iiif/fh878gz0315-canvas-521.json')) } diff --git a/spec/features/exhibit_index_spec.rb b/spec/features/exhibit_index_spec.rb index 9682e095c..157024c16 100644 --- a/spec/features/exhibit_index_spec.rb +++ b/spec/features/exhibit_index_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -describe 'the exhibit home page' do +RSpec.describe 'the exhibit home page' do it 'loads the home page' do visit '/' end diff --git a/spec/features/exhibit_spec.rb b/spec/features/exhibit_spec.rb index 138cc70b2..65f8926c1 100644 --- a/spec/features/exhibit_spec.rb +++ b/spec/features/exhibit_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -describe 'an exhibit' do +RSpec.describe 'an exhibit' do let!(:exhibit) { create(:exhibit) } it 'loads the home page' do diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb index 26df0e794..7c4cb8216 100644 --- a/spec/helpers/application_helper_spec.rb +++ b/spec/helpers/application_helper_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -describe ApplicationHelper do +RSpec.describe ApplicationHelper do describe '#collection_title' do it 'unmangles the collection title from the compound field' do expect(helper.collection_title('foo-|-bar')).to eq 'bar' diff --git a/spec/helpers/catalog_helper_spec.rb b/spec/helpers/catalog_helper_spec.rb index 89fa4e817..b8ac01d90 100644 --- a/spec/helpers/catalog_helper_spec.rb +++ b/spec/helpers/catalog_helper_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -describe CatalogHelper do +RSpec.describe CatalogHelper do describe '#has_thumbnail?' do context 'for references' do let(:document) { SolrDocument.new(format_main_ssim: ['Reference']) } 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..1fe2f59e8 100644 --- a/spec/jobs/send_publish_state_change_notification_job_spec.rb +++ b/spec/jobs/send_publish_state_change_notification_job_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -describe SendPublishStateChangeNotificationJob do +RSpec.describe SendPublishStateChangeNotificationJob do let(:job) { described_class.perform_now(exhibit: exhibit, published: published) } let(:exhibit) { FactoryBot.create(:exhibit) } diff --git a/spec/models/dor_harvester_spec.rb b/spec/models/dor_harvester_spec.rb index 94d4125e5..7b588200f 100644 --- a/spec/models/dor_harvester_spec.rb +++ b/spec/models/dor_harvester_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -describe DorHarvester do +RSpec.describe DorHarvester do subject(:harvester) { described_class.create druid_list: druid, exhibit: exhibit } let(:exhibit) { create(:exhibit) } diff --git a/spec/models/exhibit_bot_spec.rb b/spec/models/exhibit_bot_spec.rb index 6f8290d59..35ea4c7bf 100644 --- a/spec/models/exhibit_bot_spec.rb +++ b/spec/models/exhibit_bot_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -describe ExhibitBot do +RSpec.describe ExhibitBot do let(:bot) { described_class.new } context 'when notifications are configured' do diff --git a/spec/models/feature_flags_spec.rb b/spec/models/feature_flags_spec.rb index 5eb5730f5..60511f975 100644 --- a/spec/models/feature_flags_spec.rb +++ b/spec/models/feature_flags_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -describe FeatureFlags do +RSpec.describe FeatureFlags do subject(:feature_flags) { described_class.new(settings).for(exhibit) } let(:exhibit) { create(:exhibit) } diff --git a/spec/models/full_text_parser_spec.rb b/spec/models/full_text_parser_spec.rb index b850eecb7..d44426f8c 100644 --- a/spec/models/full_text_parser_spec.rb +++ b/spec/models/full_text_parser_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -describe FullTextParser do +RSpec.describe FullTextParser do subject(:parser) { described_class.new(purl_object) } let(:purl_object) { double('PurlObject', bare_druid: 'cc842mn9348', public_xml: public_xml) } diff --git a/spec/models/purl_spec.rb b/spec/models/purl_spec.rb index d1455a6d5..69097f2f3 100644 --- a/spec/models/purl_spec.rb +++ b/spec/models/purl_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -describe Purl do +RSpec.describe Purl do subject(:purl) { described_class.new(druid) } before do diff --git a/spec/models/solr_document_spec.rb b/spec/models/solr_document_spec.rb index b2ab08fa6..2b02b813c 100644 --- a/spec/models/solr_document_spec.rb +++ b/spec/models/solr_document_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -describe SolrDocument do +RSpec.describe SolrDocument do describe '#export_as_mods' do subject { described_class.new(modsxml: '123') } diff --git a/spec/models/spotlight/exhibit_spec.rb b/spec/models/spotlight/exhibit_spec.rb index 38f164e27..65620de9a 100644 --- a/spec/models/spotlight/exhibit_spec.rb +++ b/spec/models/spotlight/exhibit_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -describe Spotlight::Exhibit do +RSpec.describe Spotlight::Exhibit do describe 'exhibit extensions' do context 'when an exhibit is published' do let(:exhibit) { FactoryBot.create(:exhibit, published: false) } diff --git a/spec/models/spotlight/resources/iiif_manifest_spec.rb b/spec/models/spotlight/resources/iiif_manifest_spec.rb index 6f342cd2c..8c1ba9100 100644 --- a/spec/models/spotlight/resources/iiif_manifest_spec.rb +++ b/spec/models/spotlight/resources/iiif_manifest_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -describe Spotlight::Resources::IiifManifest do +RSpec.describe Spotlight::Resources::IiifManifest do let(:manifest) do { 'thumbnail' => { diff --git a/spec/models/spotlight/resources/upload_spec.rb b/spec/models/spotlight/resources/upload_spec.rb index 98c335e2c..30b1924fb 100644 --- a/spec/models/spotlight/resources/upload_spec.rb +++ b/spec/models/spotlight/resources/upload_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -describe Spotlight::Resources::Upload do +RSpec.describe Spotlight::Resources::Upload do subject(:resource) { described_class.create! exhibit: exhibit, upload: upload } let(:exhibit) { create(:exhibit) } diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 93b3ff278..69422fa15 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -describe User do +RSpec.describe User do subject { create(:user) } describe '#shibboleth_groups=' do diff --git a/spec/models/viewer_spec.rb b/spec/models/viewer_spec.rb index 9c1920df7..ad5321bf7 100644 --- a/spec/models/viewer_spec.rb +++ b/spec/models/viewer_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -describe Viewer do +RSpec.describe Viewer do let(:viewer) { create(:viewer) } it 'belongs to an exhibit' do diff --git a/spec/requests/exhibit_finder_requests_spec.rb b/spec/requests/exhibit_finder_requests_spec.rb index 199e380ee..797141111 100644 --- a/spec/requests/exhibit_finder_requests_spec.rb +++ b/spec/requests/exhibit_finder_requests_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -describe 'Exhibit Finder API' do +RSpec.describe 'Exhibit Finder API' do let(:exhibit) { create(:exhibit) } describe '#show' do diff --git a/spec/requests/index_statuses_requests_spec.rb b/spec/requests/index_statuses_requests_spec.rb index d5e231833..31fe2992d 100644 --- a/spec/requests/index_statuses_requests_spec.rb +++ b/spec/requests/index_statuses_requests_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -describe 'Index Statuses' do +RSpec.describe 'Index Statuses' do let(:exhibit) { create(:exhibit) } let(:user) { nil } let(:resource) { DorHarvester.create(exhibit: exhibit) } diff --git a/spec/requests/viewers_spec.rb b/spec/requests/viewers_spec.rb index 2259fe40d..932fa3ac2 100644 --- a/spec/requests/viewers_spec.rb +++ b/spec/requests/viewers_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -describe 'Viewer Configuration' do +RSpec.describe 'Viewer Configuration' do let(:exhibit) { create(:exhibit) } let(:user) { nil } let(:viewer) { Viewer.create(exhibit_id: exhibit.id) } diff --git a/spec/services/search_across_search_builder_spec.rb b/spec/services/search_across_search_builder_spec.rb index 035830d97..0a78cce44 100644 --- a/spec/services/search_across_search_builder_spec.rb +++ b/spec/services/search_across_search_builder_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -describe SearchAcrossSearchBuilder do +RSpec.describe SearchAcrossSearchBuilder do subject(:search_builder) { described_class.new(scope) } let(:scope) do diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 8f508c07b..b46efcc2b 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -30,12 +30,7 @@ mocks.verify_partial_doubles = true end - # Limits the available syntax to the non-monkey patched syntax that is recommended. - # For more details, see: - # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax - # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/ - # - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching - # config.disable_monkey_patching! + config.disable_monkey_patching! config.default_formatter = 'doc' if config.files_to_run.one? diff --git a/spec/views/catalog/_bibliography_buttons_default.html.erb_spec.rb b/spec/views/catalog/_bibliography_buttons_default.html.erb_spec.rb index ac64bbb16..95020b932 100644 --- a/spec/views/catalog/_bibliography_buttons_default.html.erb_spec.rb +++ b/spec/views/catalog/_bibliography_buttons_default.html.erb_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -describe 'catalog/_bibliography_buttons_default' do +RSpec.describe 'catalog/_bibliography_buttons_default' do let(:document) { SolrDocument.new(format_main_ssim: 'Reference', bibtex_key_ss: url) } before do diff --git a/spec/views/catalog/_embedded_mirador3.html.erb_spec.rb b/spec/views/catalog/_embedded_mirador3.html.erb_spec.rb index eacffca5d..5db841dc5 100644 --- a/spec/views/catalog/_embedded_mirador3.html.erb_spec.rb +++ b/spec/views/catalog/_embedded_mirador3.html.erb_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -describe 'catalog/_embedded_mirador3' do +RSpec.describe 'catalog/_embedded_mirador3' do let(:document) { SolrDocument.new(id: 'abc', iiif_manifest_url_ssi: manifest_url) } let(:manifest_url) { 'http://example.com/iiif/manifest' } 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 13927d701..e9b3ea205 100644 --- a/spec/views/catalog/_metadata_button_default.html.erb_spec.rb +++ b/spec/views/catalog/_metadata_button_default.html.erb_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -describe 'catalog/_metadata_button_default' do +RSpec.describe 'catalog/_metadata_button_default' do let(:document) { SolrDocument.new(modsxml: 'stuff', id: 'abc') } let(:current_exhibit) { create(:exhibit) } diff --git a/spec/views/viewers/edit.html.erb_spec.rb b/spec/views/viewers/edit.html.erb_spec.rb index 184d1b8a1..50951bf4a 100644 --- a/spec/views/viewers/edit.html.erb_spec.rb +++ b/spec/views/viewers/edit.html.erb_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -describe 'viewers/edit' do +RSpec.describe 'viewers/edit' do let(:exhibit) { create(:exhibit) } let(:viewer) { Viewer.create(exhibit_id: exhibit.id) }