Sha256: c9b744810ca79aaad4d64ad919710d3aba830e3c7510d8076115946dedf546aa

Contents?: true

Size: 1.17 KB

Versions: 5

Compression:

Stored size: 1.17 KB

Contents

require 'page_magic/driver'

module PageMagic
  describe Driver do
    subject do
      described_class.new :custom_browser
    end

    describe '#supports?' do
      context 'browser is in supported browsers' do
        it 'returns true' do
          expect(subject.support?(:custom_browser)).to eq(true)
        end
      end

      context 'browser is not in supported browsers' do
        it 'returns false' do
          expect(subject.support?(:unsupported_browser)).to eq(false)
        end
      end
    end
    describe '#build' do

      it 'returns the result of the block passed to the driver class constructor' do
        subject = described_class.new(:custom_browser)do
          :driver
        end
        expect(subject.build(:rack_app, browser: :custom_browser, options: :options)).to eq(:driver)
      end

      it 'passes rack app to the handler' do
        subject = described_class.new(:custom_browser) do |app, options, browser|
            expect(app).to eq(:rack_app)
            expect(options).to eq(:options)
            expect(browser).to eq(:browser)
        end

        subject.build(:rack_app, options: :options, browser: :browser)
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
page_magic-1.0.0.alpha13 spec/page_magic/driver_spec.rb
page_magic-1.0.0.alpha12 spec/page_magic/driver_spec.rb
page_magic-1.0.0.alpha11 spec/page_magic/driver_spec.rb
page_magic-1.0.0.alpha10 spec/page_magic/driver_spec.rb
page_magic-1.0.0.alpha9 spec/page_magic/driver_spec.rb