Sha256: a384c9aac271864fe274af10c292e30f8e7eb4c583e8defa63c855a5a8cf8c17

Contents?: true

Size: 1.57 KB

Versions: 11

Compression:

Stored size: 1.57 KB

Contents

require 'spec_helper'

describe SeleniumRC::Server do

  def new_server(*args)
    server = SeleniumRC::Server.new(*args)
    stub(server).log
    stub(server).fork.yields
    server
  end

  describe ".boot" do
    let(:server) { new_server('localhost', 5555, {:timeout => 1}) }

    before do
      mock(server).start { true }
    end

    context "when the selenium server starts successfully" do
      it "returns an instance of the server" do
        mock(server).ready? { true }
        server.boot.should == server
      end
    end

    context "when the selenium server fails to start" do
      it "raises an exception after 60 seconds" do
        mock(server).ready?.any_number_of_times { false }
        expect { server.boot.should }.to raise_error(SystemExit)
      end
    end
  end

  describe "#start" do
    it "launches java with the jar file and port" do
      server = new_server("0.0.0.0", 5555)
      expected_command = %Q{java -jar "/path/to/the.jar" -port 5555}
      mock(server).system(expected_command)
      mock(SeleniumRC::Server).jar_path {"/path/to/the.jar"}
      server.start
    end

    context "when passed additional arguments" do
      it "adds the additional arguments to the selenium start command" do
        server = new_server("0.0.0.0", 4444, :args => ["-browserSideLog", "-suppressStupidness"])
        expected_command = %Q{java -jar "/path/to/the.jar" -port 4444 -browserSideLog -suppressStupidness}
        mock(server).system(expected_command)
        mock(SeleniumRC::Server).jar_path {"/path/to/the.jar"}
        server.start
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
selenium-rc-latest-2.53.0 spec/selenium_rc/server_spec.rb
selenium-rc-latest-2.47.1.2 spec/selenium_rc/server_spec.rb
selenium-rc-latest-2.47.1.1 spec/selenium_rc/server_spec.rb
selenium-rc-latest-2.47.1 spec/selenium_rc/server_spec.rb
selenium-rc-latest-2.39.0 spec/selenium_rc/server_spec.rb
selenium-rc-2.16.1.2 spec/selenium_rc/server_spec.rb
selenium-rc-2.20.0 spec/selenium_rc/server_spec.rb
selenium-rc-2.4.0 spec/selenium_rc/server_spec.rb
selenium-rc-2.3.2 spec/selenium_rc/server_spec.rb
selenium-rc-2.3.1 spec/selenium_rc/server_spec.rb
selenium-rc-2.3.0 spec/selenium_rc/server_spec.rb