Sha256: 90cbaf71203e07add7daf2622115678e0c1d2858e12198a1bc089163e9dea99a
Contents?: true
Size: 988 Bytes
Versions: 5
Compression:
Stored size: 988 Bytes
Contents
require 'rspec' require 'stringio' require "yajl" require_relative "gorgon_rspec_formatter" class RspecRunner class << self def run_file(filename) args = [ '-f', 'RSpec::Core::Formatters::GorgonRspecFormatter', filename ] err, out = StringIO.new, StringIO.new keep_config_modules do RSpec::Core::Runner.run(args, err, out) end out.rewind Yajl::Parser.new(symbolize_keys: true).parse(out.read) end def runner :rspec end private def keep_config_modules orig_configuration = ::RSpec.configuration.clone orig_shared_example_groups = ::RSpec.world.instance_variable_get(:@shared_example_group_registry).clone yield ensure ::RSpec.clear_examples ::RSpec.instance_variable_set(:@configuration, orig_configuration) ::RSpec.world.instance_variable_set(:@shared_example_group_registry, orig_shared_example_groups) end end end
Version data entries
5 entries across 5 versions & 1 rubygems