Sha256: dc7c49a27b1ee5b3e281bce0835078a103aad636959f776e53e00e65a352f9e3

Contents?: true

Size: 1.15 KB

Versions: 6

Compression:

Stored size: 1.15 KB

Contents

# frozen_string_literal: true

require "spec_helper"

RSpec.describe Quke::DriverRegistration do
  describe "#register" do

    context "A valid driver is passed to the method" do
      %i[firefox chrome browserstack phantomjs].each do |driver|
        it "returns the value :#{driver} when that driver is selected" do
          Quke::Configuration.file_location = data_path(".#{driver}.yml")
          config = Quke::Configuration.new
          driver_config = Quke::DriverConfiguration.new(config)
          driver_reg = Quke::DriverRegistration.new(driver_config, config)
          driver = driver_reg.register(config.driver)
          expect(driver).to eq(driver)
        end
      end
    end

    context "An unrecognised driver is passed to the method" do
      it "returns the default value :phantomjs" do
        Quke::Configuration.file_location = data_path(".invalid.yml")
        config = Quke::Configuration.new
        driver_config = Quke::DriverConfiguration.new(config)
        driver_reg = Quke::DriverRegistration.new(driver_config, config)
        driver = driver_reg.register(config.driver)
        expect(driver).to eq(driver)
      end
    end
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
quke-0.10.0 spec/quke/driver_registration_spec.rb
quke-0.9.1 spec/quke/driver_registration_spec.rb
quke-0.9.0 spec/quke/driver_registration_spec.rb
quke-0.8.0 spec/quke/driver_registration_spec.rb
quke-0.7.1 spec/quke/driver_registration_spec.rb
quke-0.7.0 spec/quke/driver_registration_spec.rb