Sha256: 92a6c3f43d90fe9cd17c7fea21d4f9d9ef80418178a39e9b1506d5094f05966f

Contents?: true

Size: 1.61 KB

Versions: 5

Compression:

Stored size: 1.61 KB

Contents

require 'spec_helper'
require 'http'

describe Geckodriver::Helper do
  let(:helper) { Geckodriver::Helper.new }

  RSpec::Matchers.define :be_reachable do
    match do |download_url|
      response = HTTP.head download_url
      location = response["Location"]
      expect(response["Location"]).to include("github-production-release-asset")
      expect(response["Location"]).to include("s3.amazonaws.com")
    end
  end

  describe '#binary_path' do
    context 'on a linux32 platform' do
      before { allow(helper).to receive(:platform) { 'linux32' } }
      it { expect(helper.download_url).to be_reachable }
      it { expect(helper.binary_path).to match(/geckodriver$/) }
    end

    context 'on a linux64 platform' do
      before { allow(helper).to receive(:platform) { 'linux64' } }
      it { expect(helper.download_url).to be_reachable }
      it { expect(helper.binary_path).to match(/geckodriver$/) }
    end

    context 'on a mac platform' do
      before { allow(helper).to receive(:platform) { 'macos' } }
      it { expect(helper.download_url).to be_reachable }
      it { expect(helper.binary_path).to match(/geckodriver$/) }
    end

    context 'on a windows32 platform' do
      before { allow(helper).to receive(:platform) { 'win32' } }
      it { expect(helper.download_url).to be_reachable }
      it { expect(helper.binary_path).to match(/geckodriver\.exe$/) }
    end

    context 'on a windows64 platform' do
      before { allow(helper).to receive(:platform) { 'win64' } }
      it { expect(helper.download_url).to be_reachable }
      it { expect(helper.binary_path).to match(/geckodriver\.exe$/) }
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
geckodriver-helper-0.24.0 spec/helper_spec.rb
geckodriver-helper-0.23.0 spec/helper_spec.rb
geckodriver-helper-0.21.0 spec/helper_spec.rb
geckodriver-helper-0.20.2 spec/helper_spec.rb
geckodriver-helper-0.20.1 spec/helper_spec.rb