Skip to content

Commit

Permalink
Merge pull request #3 from appbot/delay-rspec-formatter-registration
Browse files Browse the repository at this point in the history
Move registration of formatter to configure time
  • Loading branch information
gondalez authored Aug 22, 2024
2 parents 84abebc + 794ac4f commit f6c3cdb
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 2 additions & 0 deletions lib/simplecov/inline/integration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ module Inline
class Integration
class << self
def configure_rspec_rails(rspec: RSpec, rails: Rails)
RSpec::Core::Formatters.register SimpleCov::Inline::RSpecFormatterSkipOnFailure, :dump_failures

rspec.configure do |rspec_config|
rspec_config.add_formatter SimpleCov::Inline::RSpecFormatterSkipOnFailure
rspec_config.before(:suite) do
Expand Down
2 changes: 0 additions & 2 deletions lib/simplecov/inline/rspec_formatter_skip_on_failure.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
module SimpleCov
module Inline
class RSpecFormatterSkipOnFailure
RSpec::Core::Formatters.register self, :dump_failures

def initialize(output)
@output = output
end
Expand Down
9 changes: 9 additions & 0 deletions spec/lib/simplecov/inline/integration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,15 @@
allow(rspec_config).to receive(:add_formatter)
allow(rspec_config).to receive(:before)
allow(described_class).to receive(:configure_formatter)
allow(RSpec::Core::Formatters).to receive(:register)
end

it 'registers the rspec formatter' do
subject

expect(RSpec::Core::Formatters)
.to have_received(:register)
.with(SimpleCov::Inline::RSpecFormatterSkipOnFailure, :dump_failures)
end

it 'adds a formatter to the rspec config', :aggregate_failures do
Expand Down

0 comments on commit f6c3cdb

Please sign in to comment.