Sha256: e5a111d6e091df6d42eb0d1b5c36467b57ba1d8220bbdeba8cda0032e591144c

Contents?: true

Size: 1.65 KB

Versions: 5

Compression:

Stored size: 1.65 KB

Contents

require 'spec_helper'

module RSpec::Core
  describe Runner do
    describe 'at_exit' do
      it 'sets an at_exit hook if none is already set' do
        RSpec::Core::Runner.stub(:installed_at_exit?).and_return(false)
        RSpec::Core::Runner.stub(:running_in_drb?).and_return(false)
        RSpec::Core::Runner.stub(:at_exit_hook_disabled?).and_return(false)
        RSpec::Core::Runner.should_receive(:at_exit)
        RSpec::Core::Runner.autorun
      end
      
      it 'does not set the at_exit hook if it is already set' do
        RSpec::Core::Runner.stub(:installed_at_exit?).and_return(true)
        RSpec::Core::Runner.stub(:running_in_drb?).and_return(false)
        RSpec::Core::Runner.stub(:at_exit_hook_disabled?).and_return(false)
        RSpec::Core::Runner.should_receive(:at_exit).never
        RSpec::Core::Runner.autorun
      end
    end
    
    describe "#run" do
      context "with --drb or -X" do
        before(:each) do
          @err = @out = StringIO.new

          @options = RSpec::Core::ConfigurationOptions.new(%w[--drb --drb-port 8181 --color])
          RSpec::Core::ConfigurationOptions.stub(:new) { @options }
          
          @drb_proxy = double(RSpec::Core::DRbCommandLine, :run => true)
          RSpec::Core::DRbCommandLine.stub(:new => @drb_proxy)
        end
        
        it "builds a DRbCommandLine" do
          RSpec::Core::DRbCommandLine.should_receive(:new)
          RSpec::Core::Runner.run(%w[ --drb ], @err, @out)
        end

        it "runs specs over the proxy" do
          @drb_proxy.should_receive(:run).with(@err, @out)
          RSpec::Core::Runner.run(%w[ --drb ], @err, @out)
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rspec-core-2.0.0.beta.17 spec/rspec/core/runner_spec.rb
rspec-core-2.0.0.beta.16 spec/rspec/core/runner_spec.rb
rspec-core-2.0.0.beta.15 spec/rspec/core/runner_spec.rb
rspec-core-2.0.0.beta.14 spec/rspec/core/runner_spec.rb
rspec-core-2.0.0.beta.13 spec/rspec/core/runner_spec.rb