Sha256: a79763200625199a4a50a4244903268f30f846bbfb99da588462b54cfc82d348

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 IPhone
      describe Bridge do
        let(:default_url) { URI.parse(IPhone::Bridge::DEFAULT_URL) }
        let(:resp)        { {"sessionId" => "foo", "value" => Remote::Capabilities.iphone.as_json }}
        let(:http)        { double(Remote::Http::Default, :call => resp).as_null_object   }

        it "uses the default iPhone driver URL" do
          http.should_receive(:server_url=).with default_url
          Bridge.new(:http_client => http)
        end

        it "uses the user-provided URL" do
          http.should_receive(:server_url=).with URI.parse("http://example.com")
          Bridge.new(:http_client => http, :url => "http://example.com")
        end

        it "uses the default HTTP client when none is specified" do
          Remote::Http::Default.should_receive(:new).and_return http
          Bridge.new
        end

        it 'takes desired capabilities' do
          custom_caps = Remote::Capabilities.new
          custom_caps['foo'] = 'bar'

          http.should_receive(:call).with do |_, _, payload|
            payload[:desiredCapabilities]['foo'].should == 'bar'
            resp
          end

          Bridge.new(:http_client => http, :desired_capabilities => custom_caps)
        end
      end

    end # IPhone
  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/iphone/bridge_spec.rb
browserstack-webdriver-0.0.22 spec/unit/selenium/webdriver/iphone/bridge_spec.rb
browserstack-webdriver-0.0.1 spec/unit/selenium/webdriver/iphone/bridge_spec.rb