Sha256: 6211befd9fb868a54aaa0a33081d2501fa987356f6103226e35053080ff66721

Contents?: true

Size: 748 Bytes

Versions: 11

Compression:

Stored size: 748 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
      config_modules = RSpec.configuration.include_or_extend_modules
      yield
      RSpec.configuration.include_or_extend_modules = config_modules
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
gorgon-0.6.4 lib/gorgon/rspec_runner.rb
gorgon-0.6.3 lib/gorgon/rspec_runner.rb
gorgon-0.6.2 lib/gorgon/rspec_runner.rb
gorgon-0.6.1 lib/gorgon/rspec_runner.rb
gorgon-0.6.0 lib/gorgon/rspec_runner.rb
gorgon-0.6.0.rc2 lib/gorgon/rspec_runner.rb
gorgon-0.6.0.rc1 lib/gorgon/rspec_runner.rb
gorgon-0.5.0.rc1 lib/gorgon/rspec_runner.rb
gorgon-0.4.5 lib/gorgon/rspec_runner.rb
gorgon-0.4.5.rc1 lib/gorgon/rspec_runner.rb
gorgon-0.4.4 lib/gorgon/rspec_runner.rb