Sha256: 0a7c486a2ba639c22133770dbfbc25a742d5a6472cf6b38295bbb8ebd4faff8a

Contents?: true

Size: 1.53 KB

Versions: 24

Compression:

Stored size: 1.53 KB

Contents

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

describe Sauce::Selenium2 do
  let(:mock_driver) { Hash.new }

  before :each do
    ::Selenium::WebDriver.should_receive(:for).and_return(mock_driver)
  end

  describe '#initialize' do
    it 'should work without arguments' do
      client = Sauce::Selenium2.new
      client.should_not be nil
    end

    it 'should pass the job_name argument into the config' do
      expected = 'Dummy Job Name'
      client = Sauce::Selenium2.new(:job_name => expected)
      client.config[:job_name].should == expected
    end
  end


  context 'with an initialized object' do
    before :each do
      @client = Sauce::Selenium2.new
    end

    describe '#stop' do
      it 'should call quit on the driver' do
        @client.driver.should_receive(:quit).and_return(true)
        @client.stop
      end
    end

    describe '#session_id' do
      it 'should query the driver for the session_id' do
        expected = 101
        bridge = mock('bridge')
        bridge.should_receive(:session_id).and_return(expected)
        @client.driver.should_receive(:bridge).and_return(bridge)
        @client.session_id.should == expected
      end
    end

    describe '#method_missing' do
      it 'should pass #navigate#to onto the driver' do
        url = 'http://example.com'
        navigator = mock('navigator')
        navigator.should_receive(:to).with(url).and_return(true)
        @client.driver.should_receive(:navigate).and_return(navigator)

        @client.navigate.to url
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
sauce-3.0.4 spec/sauce/selenium_spec.rb
sauce-3.0.2 spec/sauce/selenium_spec.rb
sauce-3.0.1 spec/sauce/selenium_spec.rb
sauce-3.0.0 spec/sauce/selenium_spec.rb
sauce-2.5.2 spec/sauce/selenium_spec.rb
sauce-3.0.0.beta.2 spec/sauce/selenium_spec.rb
sauce-2.5.1 spec/sauce/selenium_spec.rb
sauce-2.4.6 spec/sauce/selenium_spec.rb
sauce-2.4.5 spec/sauce/selenium_spec.rb
sauce-2.4.4 spec/sauce/selenium_spec.rb
sauce-2.4.3 spec/sauce/selenium_spec.rb
sauce-2.4.2 spec/sauce/selenium_spec.rb
sauce-2.4.1 spec/sauce/selenium_spec.rb
sauce-2.4.0 spec/sauce/selenium_spec.rb
sauce-2.3.6 spec/sauce/selenium_spec.rb
sauce-2.3.5 spec/sauce/selenium_spec.rb
sauce-2.3.4 spec/sauce/selenium_spec.rb
sauce-2.3.3 spec/sauce/selenium_spec.rb
sauce-2.3.2 spec/sauce/selenium_spec.rb
sauce-2.2.2 spec/sauce/selenium_spec.rb