Sha256: 57f4190393df1019b1182136412692bd5e42a459efd926460765374f862476ec

Contents?: true

Size: 1018 Bytes

Versions: 9

Compression:

Stored size: 1018 Bytes

Contents

require "spec_helper"

describe Webdrivers::Geckodriver do

  let(:geckodriver) { Webdrivers::Geckodriver }

  it 'finds latest version' do
    expect(geckodriver.latest).to be > 0.17
    expect(geckodriver.latest).to be < 0.2
  end

  it 'downloads latest version by default' do
    geckodriver.download
    expect(geckodriver.current).to eq geckodriver.latest
  end

  it 'downloads specified version' do
    geckodriver.remove
    geckodriver.download(0.17)
    expect(geckodriver.current).to eq 0.17
  end

  it 'removes geckodriver' do
    geckodriver.remove
    expect(geckodriver.current).to be_nil
  end

  context 'when offline' do
    before { allow(geckodriver).to receive(:site_available?).and_return(false) }

    it 'raises exception finding latest version' do
      expect {geckodriver.latest}.to raise_error(StandardError, "Can not reach site")
    end

    it 'raises exception downloading' do
      expect {geckodriver.download}.to raise_error(StandardError, "Can not reach site")
    end
  end

end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
webdrivers-3.2.3 spec/geckodriver_spec.rb
webdrivers-3.2.2 spec/geckodriver_spec.rb
webdrivers-3.2.1 spec/geckodriver_spec.rb
webdrivers-3.2.0 spec/geckodriver_spec.rb
webdrivers-3.1.0 spec/geckodriver_spec.rb
webdrivers-3.0.1 spec/geckodriver_spec.rb
webdrivers-3.0.0 spec/geckodriver_spec.rb
webdrivers-3.0.0.beta3 spec/geckodriver_spec.rb
webdrivers-3.0.0.beta2 spec/geckodriver_spec.rb