Sha256: e1c093cecd434e997f7bcd14a31fac38782e60fb4aa96f913fa7421454bd40fc

Contents?: true

Size: 1.36 KB

Versions: 3

Compression:

Stored size: 1.36 KB

Contents

require File.expand_path("../../spec_helper", __FILE__)

module Selenium
  module WebDriver
    module Chrome

      describe Service do
        let(:mock_process) do
          double("ChildProcess", :io => double.as_null_object, :start => true)
        end

        # ugh.
        before { Service.instance_variable_set("@executable_path", nil) }

        it "uses the user-provided path if set" do
          Platform.stub(:os => :unix)
          Platform.stub(:assert_executable).with("/some/path")
          Chrome.driver_path = "/some/path"

          ChildProcess.should_receive(:build).
                       with { |*args| args.first.should == "/some/path" }.
                       and_return(mock_process)

          Service.default_service
        end

        it "finds the Chrome server binary by searching PATH" do
          Platform.stub(:os => :unix)
          Platform.should_receive(:find_binary).once.and_return("/some/path")
          Platform.should_receive(:assert_executable).with("/some/path")

          Service.executable_path.should == "/some/path"
        end

        it "raises a nice error if the server binary can't be found" do
          Platform.stub(:find_binary).and_return(nil)

          lambda { Service.executable_path }.should raise_error(Error::WebDriverError, /code\.google\.com/)
        end

      end
    end # Chrome
  end # WebDriver
end # Selenium

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
browserstack-webdriver-2.40.1 spec/unit/selenium/webdriver/chrome/service_spec.rb
browserstack-webdriver-0.0.22 spec/unit/selenium/webdriver/chrome/service_spec.rb
browserstack-webdriver-0.0.1 spec/unit/selenium/webdriver/chrome/service_spec.rb