Skip to content

Commit

Permalink
prevent duplicate runs
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Dunn committed Mar 15, 2021
1 parent 5e70faf commit 0e86836
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions lib/flatware/rspec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,19 @@ def extract_jobs_from_args(args, workers:)
JobBuilder.new(args, workers: workers).jobs
end

def run(job, _options = {})
runner = ::RSpec::Core::Runner
def runner.trap_interrupt() end
def runner
::RSpec::Core::Runner.tap do |runner|
def runner.trap_interrupt() end
end
end

profile_examples = ::RSpec.configuration.profile_examples
::RSpec.reset
::RSpec.configuration.profile_examples = profile_examples
def run(job, _options = [])
::RSpec.configuration.deprecation_stream = StringIO.new
::RSpec.configuration.output_stream = StringIO.new
::RSpec.configuration.add_formatter(Flatware::RSpec::Formatter)

runner.run(Array(job), $stderr, $stdout)
::RSpec.reset # prevents duplicate runs
end
end
end

0 comments on commit 0e86836

Please sign in to comment.