Sha256: ee2f02d3d14b390ce2ca9d9b30789a4cf9da347864bc783ea3f5d4928f33aa58

Contents?: true

Size: 1009 Bytes

Versions: 10

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 '#register' do
      it 'stores the driver' do
        subject.register expected_driver
        expect(subject.all).to eq([expected_driver])
      end
    end

    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
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
page_magic-1.0.0.alpha17 spec/page_magic/drivers_spec.rb
page_magic-1.0.0.alpha13 spec/page_magic/drivers_spec.rb
page_magic-1.0.0.alpha12 spec/page_magic/drivers_spec.rb
page_magic-1.0.0.alpha11 spec/page_magic/drivers_spec.rb
page_magic-1.0.0.alpha10 spec/page_magic/drivers_spec.rb
page_magic-1.0.0.alpha9 spec/page_magic/drivers_spec.rb
page_magic-1.0.0.alpha8 spec/page_magic/drivers_spec.rb
page_magic-1.0.0.alpha7 spec/page_magic/drivers_spec.rb
page_magic-1.0.0.alpha6 spec/page_magic/drivers_spec.rb
page_magic-1.0.0.alpha5 spec/page_magic/drivers_spec.rb