Skip to content

Commit

Permalink
experiment! define name to work around TaggedLogging
Browse files Browse the repository at this point in the history
RSpec.current_example.metadata[:name] evaluates to `nil` by the time
this is called.
  • Loading branch information
pirj committed Apr 11, 2022
1 parent d372749 commit a34dea7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
10 changes: 10 additions & 0 deletions lib/rspec/rails/adapters.rb
Original file line number Diff line number Diff line change
Expand Up @@ -181,5 +181,15 @@ def assertion_delegator
#
# @private
TestUnitAssertionAdapter = MinitestAssertionAdapter

# @private
module TaggedLoggingAdapter
require 'active_support/testing/tagged_logging'
include ActiveSupport::Testing::TaggedLogging

# Just a stub as TaggedLogging is calling `name`
def name
end
end
end
end
6 changes: 1 addition & 5 deletions lib/rspec/rails/example/rails_example_group.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,7 @@ module RailsExampleGroup
include RSpec::Rails::MinitestLifecycleAdapter
include RSpec::Rails::MinitestAssertionAdapter
include RSpec::Rails::FixtureSupport

if ::Rails::VERSION::MAJOR >= 7
require 'active_support/testing/tagged_logging'
include ActiveSupport::Testing::TaggedLogging
end
include RSpec::Rails::TaggedLoggingAdapter if ::Rails::VERSION::MAJOR >= 7
end
end
end

0 comments on commit a34dea7

Please sign in to comment.