Module: Flatware::RSpec

Defined in:
lib/flatware/rspec.rb,
lib/flatware/rspec/formatter.rb,
lib/flatware/rspec/checkpoint.rb,
lib/flatware/rspec/job_builder.rb,
lib/flatware/rspec/marshalable.rb,
lib/flatware/rspec/formatters/console.rb,
lib/flatware/rspec/marshalable/example.rb,
lib/flatware/rspec/marshalable/example_group.rb,
lib/flatware/rspec/marshalable/execution_result.rb,
lib/flatware/rspec/marshalable/profile_notification.rb,
lib/flatware/rspec/marshalable/summary_notification.rb,
lib/flatware/rspec/marshalable/examples_notification.rb,
lib/flatware/rspec/marshalable/deprecation_notification.rb,
lib/flatware/rspec/marshalable/shared_group_inclusion_backtrace.rb

Defined Under Namespace

Modules: Formatters, Marshalable Classes: Checkpoint, Formatter, JobBuilder, ProgressMessage

Class Method Summary collapse

Class Method Details

.extract_jobs_from_args(args, workers:) ⇒ Object



14
15
16
# File 'lib/flatware/rspec.rb', line 14

def extract_jobs_from_args(args, workers:)
  JobBuilder.new(args, workers: workers).jobs
end

.output_streamObject



24
25
26
27
28
29
30
# File 'lib/flatware/rspec.rb', line 24

def output_stream
  StringIO.new.tap do |output|
    output.define_singleton_method(:tty?) do
      $stdout.tty?
    end
  end
end

.run(job, _options = []) ⇒ Object



32
33
34
35
36
37
38
39
# File 'lib/flatware/rspec.rb', line 32

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

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

.runnerObject



18
19
20
21
22
# File 'lib/flatware/rspec.rb', line 18

def runner
  ::RSpec::Core::Runner.tap do |runner|
    def runner.trap_interrupt() end
  end
end