Sha256: 07fdb4167de7a59b1a27b0284ff8bb2fd941841515b3bb71a13fa96e94d82fb3

Contents?: true

Size: 1.4 KB

Versions: 32

Compression:

Stored size: 1.4 KB

Contents

require File.dirname(__FILE__) + '/../../spec_helper'


module Cucumber
  module Cli
    describe DRbClient do
      before(:each) do
        @args = ['features']
        @error_stream = StringIO.new
        @out_stream = StringIO.new

        @drb_object = mock('DRbObject', :run => true)
        DRbObject.stub!(:new_with_uri).and_return(@drb_object)
      end

      it "starts up a druby service" do
        DRb.should_receive(:start_service).with("druby://localhost:0")
        DRbClient.run(@args, @error_stream, @out_stream)
      end

      it "connects to the DRb server" do
        DRbObject.should_receive(:new_with_uri).with("druby://127.0.0.1:8990")
        DRbClient.run(@args, @error_stream, @out_stream)
      end

      it "runs the fearures on the DRb server" do
        @drb_object.should_receive(:run).with(@args, @error_stream, @out_stream)
        DRbClient.run(@args, @error_stream, @out_stream)
      end

      it "returns raises an error when it can't connect to the server" do
        DRbObject.stub!(:new_with_uri).and_raise(DRb::DRbConnError)
        running { DRbClient.run(@args, @error_stream, @out_stream) }.should raise_error(DRbClientError, "No DRb server is running.")
      end

      it "returns the result from the DRb server call" do
        @drb_object.should_receive(:run).and_return('foo')
        DRbClient.run(@args, @error_stream, @out_stream).should == 'foo'
      end

    end
  end
end

Version data entries

32 entries across 32 versions & 7 rubygems

Version Path
aslakhellesoy-cucumber-0.3.11.200907091518 spec/cucumber/cli/drb_client_spec.rb
aslakhellesoy-cucumber-0.3.11.3 spec/cucumber/cli/drb_client_spec.rb
aslakhellesoy-cucumber-0.3.11.5 spec/cucumber/cli/drb_client_spec.rb
aslakhellesoy-cucumber-0.3.11.6 spec/cucumber/cli/drb_client_spec.rb
aslakhellesoy-cucumber-0.3.90 spec/cucumber/cli/drb_client_spec.rb
aslakhellesoy-cucumber-0.3.92 spec/cucumber/cli/drb_client_spec.rb
aslakhellesoy-cucumber-0.3.93.1 spec/cucumber/cli/drb_client_spec.rb
aslakhellesoy-cucumber-0.3.93 spec/cucumber/cli/drb_client_spec.rb
aslakhellesoy-cucumber-0.3.94.1 spec/cucumber/cli/drb_client_spec.rb
aslakhellesoy-cucumber-0.3.94 spec/cucumber/cli/drb_client_spec.rb
aslakhellesoy-cucumber-0.3.95 spec/cucumber/cli/drb_client_spec.rb
jwilger-cucumber-0.3.11.200906161550 spec/cucumber/cli/drb_client_spec.rb
jwilger-cucumber-0.3.11.200907091518 spec/cucumber/cli/drb_client_spec.rb
kosmas58-cucumber-0.3.11.3 spec/cucumber/cli/drb_client_spec.rb
kosmas58-cucumber-0.3.11.6 spec/cucumber/cli/drb_client_spec.rb
kosmas58-cucumber-0.3.90 spec/cucumber/cli/drb_client_spec.rb
kosmas58-cucumber-0.3.92 spec/cucumber/cli/drb_client_spec.rb
kosmas58-cucumber-0.3.93.1 spec/cucumber/cli/drb_client_spec.rb
kosmas58-cucumber-0.3.94 spec/cucumber/cli/drb_client_spec.rb
kosmas58-cucumber-0.3.95 spec/cucumber/cli/drb_client_spec.rb