Skip to content

Commit

Permalink
Work around ammeter' incompatibility with RSpec 4
Browse files Browse the repository at this point in the history
See:

- rspec/rspec-core#1821
- rspec/rspec-core#2874
- alexrothenberg/ammeter#64
- example failure (Ammeter::RSpec::Rails::GeneratorExampleGroup that defines destination is not included) https://github.com/rspec/rspec-core/pull/2874/checks?check_run_id=1942170588

Alternative to #2468
  • Loading branch information
pirj committed Feb 20, 2021
1 parent a785198 commit 3f01b64
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,14 @@ def self.run_all(reporter = nil)
example.run
end
end

# Work around ammeter's incompatibility with RSpec 4
# TODO: Remove once https://github.com/alexrothenberg/ammeter/pull/64 is merged
generator_path_regex = Regexp.compile(%w[spec generators].join('[\\\/]') + '[\\\/]')
config.include Ammeter::RSpec::Rails::GeneratorExampleGroup,
:type => :generator
config.include Ammeter::RSpec::Rails::GeneratorExampleGroup,
:file_path => lambda { |file_path, metadata|
metadata[:type].nil? && generator_path_regex =~ file_path
}
end

0 comments on commit 3f01b64

Please sign in to comment.