Sha256: b98e0b3c109b8701d9cdfb36e93b1aaa3ac47ad421851a08cd097a7b8b2d1c8f

Contents?: true

Size: 1009 Bytes

Versions: 17

Compression:

Stored size: 1009 Bytes

Contents

require 'page_magic/drivers'
module PageMagic
  describe Drivers do
    subject { described_class.new }
    let(:expected_driver) { Driver.new(:browser_driver) }

    describe '#find' do
      it 'returns the registered driver' do
        subject.register expected_driver
        expect(subject.find(:browser_driver)).to eq(expected_driver)
      end
    end

    describe '#load' do
      include_context :files
      it 'loads the drivers in the specified path' do
        class_definition = <<-RUBY
          class CustomDriver;
            def self.support? browser
              true
            end
          end
        RUBY

        File.write("#{scratch_dir}/custom_driver.rb", class_definition)

        subject.load(scratch_dir)
        expect(subject.find(:custom_browser)).to be(::CustomDriver)
      end
    end

    describe '#register' do
      it 'stores the driver' do
        subject.register expected_driver
        expect(subject.all).to eq([expected_driver])
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
page_magic-1.2.9 spec/page_magic/drivers_spec.rb
page_magic-1.2.8 spec/page_magic/drivers_spec.rb
page_magic-1.2.8.alpha spec/page_magic/drivers_spec.rb
page_magic-1.2.7 spec/page_magic/drivers_spec.rb
page_magic-1.2.6 spec/page_magic/drivers_spec.rb
page_magic-1.2.5 spec/page_magic/drivers_spec.rb
page_magic-1.2.5.alpha1 spec/page_magic/drivers_spec.rb
page_magic-1.2.4 spec/page_magic/drivers_spec.rb
page_magic-1.2.3 spec/page_magic/drivers_spec.rb
page_magic-1.2.1 spec/page_magic/drivers_spec.rb
page_magic-1.2.0 spec/page_magic/drivers_spec.rb
page_magic-1.1.0 spec/page_magic/drivers_spec.rb
page_magic-1.0.4 spec/page_magic/drivers_spec.rb
page_magic-1.0.3 spec/page_magic/drivers_spec.rb
page_magic-1.0.2 spec/page_magic/drivers_spec.rb
page_magic-1.0.1 spec/page_magic/drivers_spec.rb
page_magic-1.0.0 spec/page_magic/drivers_spec.rb