Sha256: fc530f9aba11739d16c20987ec3d0bd6b1c8e63774b103e0b3fa78e382f17835

Contents?: true

Size: 1.38 KB

Versions: 9

Compression:

Stored size: 1.38 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
    before do
      RSpec::Core::Runner.stub(:run)
    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 = stub("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

9 entries across 9 versions & 1 rubygems

Version Path
gorgon-0.4.3 spec/rspec_runner_spec.rb
gorgon-0.4.2 spec/rspec_runner_spec.rb
gorgon-0.4.1 spec/rspec_runner_spec.rb
gorgon-0.4.1.rc1 spec/rspec_runner_spec.rb
gorgon-0.4.0 spec/rspec_runner_spec.rb
gorgon-0.4.0.rc2 spec/rspec_runner_spec.rb
gorgon-0.4.0.rc1 spec/rspec_runner_spec.rb
gorgon-0.3.2 spec/rspec_runner_spec.rb
gorgon-0.3.1 spec/rspec_runner_spec.rb