Sha256: fbfa633d983094dc2eb658b1c7c2f0dc05602722540b3518429ed7200ab65178
Contents?: true
Size: 1.81 KB
Versions: 5
Compression:
Stored size: 1.81 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) RSpec.stub(configuration: configuration, instance_variable_set: nil) 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 # since configuration is reset on each run # https://github.com/rspec/rspec-core/issues/621 it 'restore initial rspec configuration' do RSpec.should_receive(:instance_variable_set). with(:@configuration, configuration) RspecRunner.run_file "file" end end describe "#runner" do it "returns :rspec" do RspecRunner.runner.should == :rspec end end end
Version data entries
5 entries across 5 versions & 1 rubygems