Skip to content

Commit

Permalink
Disable rspec monkeypatching
Browse files Browse the repository at this point in the history
  • Loading branch information
jcoyne committed Jan 22, 2025
1 parent ea726fc commit f77b250
Show file tree
Hide file tree
Showing 33 changed files with 33 additions and 38 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ git_source(:github) do |repo_name|
"https://github.com/#{repo_name}.git"
end

gem 'rails', '~> 7.2'
gem 'rails', '~> 8.0.1'
# The original asset pipeline for Rails [https://github.com/rails/sprockets-rails]
gem 'sprockets-rails'

Expand Down
2 changes: 1 addition & 1 deletion spec/controllers/application_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion spec/controllers/login_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

require 'rails_helper'

describe LoginController do
RSpec.describe LoginController do
let(:user) { create(:curator) }

before do
Expand Down
2 changes: 1 addition & 1 deletion spec/controllers/spotlight/catalog_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

require 'rails_helper'

describe Spotlight::CatalogController do
RSpec.describe Spotlight::CatalogController do
include ActiveJob::TestHelper
routes { Spotlight::Engine.routes }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
2 changes: 1 addition & 1 deletion spec/features/alt_text_instructions_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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) }
Expand Down
2 changes: 1 addition & 1 deletion spec/features/browse_category_admin_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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' }
Expand Down
2 changes: 1 addition & 1 deletion spec/features/canvas_display_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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')) }
Expand Down
2 changes: 1 addition & 1 deletion spec/features/exhibit_index_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion spec/features/exhibit_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion spec/helpers/application_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion spec/helpers/catalog_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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']) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) }

Expand Down
2 changes: 1 addition & 1 deletion spec/models/dor_harvester_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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) }
Expand Down
2 changes: 1 addition & 1 deletion spec/models/exhibit_bot_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion spec/models/feature_flags_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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) }
Expand Down
2 changes: 1 addition & 1 deletion spec/models/full_text_parser_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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) }
Expand Down
2 changes: 1 addition & 1 deletion spec/models/purl_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

require 'rails_helper'

describe Purl do
RSpec.describe Purl do
subject(:purl) { described_class.new(druid) }

before do
Expand Down
2 changes: 1 addition & 1 deletion spec/models/solr_document_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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') }

Expand Down
2 changes: 1 addition & 1 deletion spec/models/spotlight/exhibit_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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) }
Expand Down
2 changes: 1 addition & 1 deletion spec/models/spotlight/resources/iiif_manifest_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

require 'rails_helper'

describe Spotlight::Resources::IiifManifest do
RSpec.describe Spotlight::Resources::IiifManifest do
let(:manifest) do
{
'thumbnail' => {
Expand Down
2 changes: 1 addition & 1 deletion spec/models/spotlight/resources/upload_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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) }
Expand Down
2 changes: 1 addition & 1 deletion spec/models/user_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

require 'rails_helper'

describe User do
RSpec.describe User do
subject { create(:user) }

describe '#shibboleth_groups=' do
Expand Down
2 changes: 1 addition & 1 deletion spec/models/viewer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

require 'rails_helper'

describe Viewer do
RSpec.describe Viewer do
let(:viewer) { create(:viewer) }

it 'belongs to an exhibit' do
Expand Down
2 changes: 1 addition & 1 deletion spec/requests/exhibit_finder_requests_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion spec/requests/index_statuses_requests_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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) }
Expand Down
2 changes: 1 addition & 1 deletion spec/requests/viewers_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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) }
Expand Down
2 changes: 1 addition & 1 deletion spec/services/search_across_search_builder_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

require 'rails_helper'

describe SearchAcrossSearchBuilder do
RSpec.describe SearchAcrossSearchBuilder do
subject(:search_builder) { described_class.new(scope) }

let(:scope) do
Expand Down
7 changes: 1 addition & 6 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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?

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion spec/views/catalog/_embedded_mirador3.html.erb_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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' }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) }

Expand Down
2 changes: 1 addition & 1 deletion spec/views/viewers/edit.html.erb_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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) }

Expand Down

0 comments on commit f77b250

Please sign in to comment.