Module: Crabfarm::Utils::RSpecRunner
Defined Under Namespace
Classes: DummyOptions, SilentFormatter
Instance Method Summary collapse
Instance Method Details
#run_spec_for(_target, _filter = nil) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/crabfarm/utils/rspec_runner.rb', line 19 def run_spec_for(_target, _filter=nil) _target = Array(_target) # TODO: check target exist? first_time_config begin ::RSpec.configuration.files_or_directories_to_run = _target ::RSpec.configuration.inclusion_filter = _filter if _filter runner = ::RSpec::Core::Runner.new DummyOptions.new runner.run $stderr, $stdout ::RSpec.world.example_groups.map { |g| g.filtered_examples }.flatten ensure ::RSpec.clear_examples end end |