Sha256: 0cb75e3cd2ba9ac4dd1834d6466021f0d799148c25f81cd28aff92b6cdce3f50

Contents?: true

Size: 1.49 KB

Versions: 15

Compression:

Stored size: 1.49 KB

Contents

require 'gorgon/rspec_runner'

describe RspecRunner do

  subject {RspecRunner}
  it {should respond_to(:run_file).with(1).argument}
  it {should respond_to(:runner).with(0).argument}

  describe "#run_file" do
    let(:configuration) { double('Configuration') }

    before do
      RSpec::Core::Runner.stub(:run)
      RspecRunner.stub(:keep_config_modules).and_yield
    end

    it "uses Rspec runner to run filename and uses the correct options" do
      RSpec::Core::Runner.should_receive(:run).with(["-f",
                                                     "RSpec::Core::Formatters::GorgonRspecFormatter",
                                                     "file"], anything, anything)
      RspecRunner.run_file "file"
    end

    it "passes StringIO's (or something similar) to rspec runner" do
      RSpec::Core::Runner.should_receive(:run).with(anything,
                                                    duck_type(:read, :write, :close),
                                                    duck_type(:read, :write, :close))
      RspecRunner.run_file "file"
    end

    it "parses the output of the Runner and returns it" do
      str_io = double("StringIO", :rewind => nil, :read => :content)
      StringIO.stub(:new).and_return(str_io)
      Yajl::Parser.any_instance.should_receive(:parse).with(:content).and_return :result
      RspecRunner.run_file("file").should == :result
    end
  end

  describe "#runner" do
    it "returns :rspec" do
      RspecRunner.runner.should == :rspec
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
gorgon-0.11.0 spec/rspec_runner_spec.rb
gorgon-0.10.5 spec/rspec_runner_spec.rb
gorgon-0.10.4 spec/rspec_runner_spec.rb
gorgon-0.10.3 spec/rspec_runner_spec.rb
gorgon-0.10.2 spec/rspec_runner_spec.rb
gorgon-0.10.1 spec/rspec_runner_spec.rb
gorgon-0.10.0 spec/rspec_runner_spec.rb
gorgon-0.9.0 spec/rspec_runner_spec.rb
gorgon-0.8.4 spec/rspec_runner_spec.rb
gorgon-0.8.3 spec/rspec_runner_spec.rb
gorgon-0.8.2 spec/rspec_runner_spec.rb
gorgon-0.8.1 spec/rspec_runner_spec.rb
gorgon-0.8.0 spec/rspec_runner_spec.rb
gorgon-0.7.1 spec/rspec_runner_spec.rb
gorgon-0.7.0 spec/rspec_runner_spec.rb