Sha256: f742f589391199d4cbb127c5ac63b4799626e3f260d488b6c960412e9e6ea58d

Contents?: true

Size: 1.71 KB

Versions: 28

Compression:

Stored size: 1.71 KB

Contents

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

describe Sauce::Selenium2 do
  describe "itself" do

    before :each do
      mock_driver = double(::Selenium::WebDriver::Driver)
      mock_driver.stub(:file_detector=)
      ::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 = double('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 = double('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
end

Version data entries

28 entries across 28 versions & 2 rubygems

Version Path
sauce_ruby-3.5.11 spec/sauce/selenium_spec.rb
sauce_ruby-3.5.10 spec/sauce/selenium_spec.rb
sauce_ruby-3.5.9 spec/sauce/selenium_spec.rb
sauce_ruby-3.5.8 spec/sauce/selenium_spec.rb
sauce_ruby-3.5.7 spec/sauce/selenium_spec.rb
sauce_ruby-3.5.6 spec/sauce/selenium_spec.rb
sauce-3.5.6 spec/sauce/selenium_spec.rb
sauce-3.5.5 spec/sauce/selenium_spec.rb
sauce-3.5.4 spec/sauce/selenium_spec.rb
sauce-3.5.3 spec/sauce/selenium_spec.rb
sauce-3.5.2 spec/sauce/selenium_spec.rb
sauce-3.5.1 spec/sauce/selenium_spec.rb
sauce-3.5.0 spec/sauce/selenium_spec.rb
sauce-3.4.9 spec/sauce/selenium_spec.rb
sauce-3.4.8 spec/sauce/selenium_spec.rb
sauce-3.4.7 spec/sauce/selenium_spec.rb
sauce-3.4.6 spec/sauce/selenium_spec.rb
sauce-3.4.5 spec/sauce/selenium_spec.rb
sauce-3.4.4 spec/sauce/selenium_spec.rb
sauce-3.4.3 spec/sauce/selenium_spec.rb