Skip to content

Commit a3bebfd

Browse files
committed
Work around ammeter' incompatibility with RSpec 4
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
1 parent a785198 commit a3bebfd

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

spec/spec_helper.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,14 @@ def self.run_all(reporter = nil)
7474
example.run
7575
end
7676
end
77+
78+
# Work around ammeter's incompatibility with RSpec 4
79+
# TODO: Remove once https://github.com/alexrothenberg/ammeter/pull/64 is merged
80+
generator_path_regex = Regexp.compile(%w[spec generators].join('[\\\/]') + '[\\\/]')
81+
config.include Ammeter::RSpec::Rails::GeneratorExampleGroup,
82+
type: :generator
83+
config.include Ammeter::RSpec::Rails::GeneratorExampleGroup,
84+
file_path: lambda { |file_path, metadata|
85+
metadata[:type].nil? && generator_path_regex =~ file_path
86+
}
7787
end

0 commit comments

Comments
 (0)