Skip to content

Commit

Permalink
Merge pull request #3109 from projectblacklight/rspec_rails_6.1
Browse files Browse the repository at this point in the history
use rspec-rails 6.1 for official Rails 7.1 support, no need for our local patch anymore
  • Loading branch information
jcoyne authored Nov 21, 2023
2 parents f35006b + 7c847fc commit 4983d62
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 29 deletions.
2 changes: 1 addition & 1 deletion blacklight.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Gem::Specification.new do |s|
s.add_dependency "view_component", '>= 2.66', '< 4'

s.add_development_dependency "rsolr", ">= 1.0.6", "< 3" # Library for interacting with rSolr.
s.add_development_dependency "rspec-rails", "~> 6.0"
s.add_development_dependency "rspec-rails", "~> 6.1"
s.add_development_dependency "rspec-collection_matchers", ">= 1.0"
s.add_development_dependency 'axe-core-rspec'
s.add_development_dependency "capybara", '~> 3'
Expand Down
28 changes: 0 additions & 28 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -118,31 +118,3 @@
# as the one that triggered the failure.
Kernel.srand config.seed
end

# RSpec's stub_template method needs a differnet implementation for Rails 7.1, that
# isn't yet in an rspec-rails release.
#
# First rspec-rails tried this:
# https://github.com/rspec/rspec-rails/commit/4d65bea0619955acb15023b9c3f57a3a53183da8
#
# But it was subject to this problem:
# https://github.com/rspec/rspec-rails/issues/2696
#
# Below implementation appears to work for our purposes here, so we will patch it in
# if we are on Rails 7.1+, and not yet rspec-rails 6.1 which we expect to have it.

if ::Rails.version.to_f >= 7.1 && Gem.loaded_specs["rspec-rails"].version.release < Gem::Version.new('6.1')

module RSpec
module Rails
module ViewExampleGroup
module ExampleMethods
def stub_template(hash)
controller.prepend_view_path(StubResolverCache.resolver_for(hash))
end
end
end
end
end

end

0 comments on commit 4983d62

Please sign in to comment.