Skip to content

Commit

Permalink
Merge pull request toptal#126 from henrich-m/fix-simplecov-integration
Browse files Browse the repository at this point in the history
Fix Simplecov integration
  • Loading branch information
jaimerson authored Oct 30, 2020
2 parents b932e28 + 0cba6a9 commit 1a8448e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/crystalball/map_generator/coverage_strategy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def initialize(execution_detector = ExecutionDetector.new)
end

def after_register
Coverage.start
Coverage.start unless Coverage.running?
end

# Adds to the example_map's used files the ones the ones in which
Expand Down
17 changes: 14 additions & 3 deletions spec/map_generator/coverage_strategy_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,20 @@
include_examples 'base strategy'

describe '#after_register' do
it 'starts coverage' do
expect(Coverage).to receive(:start)
subject.after_register
context 'when Coverage is already running' do
it 'does nothing' do
allow(Coverage).to receive(:running?).and_return(true)
expect(Coverage).not_to receive(:start)
subject.after_register
end
end

context 'when Coverage is not running' do
it 'starts coverage' do
allow(Coverage).to receive(:running?).and_return(false)
expect(Coverage).to receive(:start)
subject.after_register
end
end
end

Expand Down

0 comments on commit 1a8448e

Please sign in to comment.