Sha256: 1b501839e4eed34b6f7c20183f5d1048ae7933e45605e5ec933e7f4212c23f5d

Contents?: true

Size: 1.16 KB

Versions: 9

Compression:

Stored size: 1.16 KB

Contents

require 'page_magic/driver'

module PageMagic
  describe Driver do
    subject do
      described_class.new :custom_browser
    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

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

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
page_magic-1.2.9 spec/page_magic/driver_spec.rb
page_magic-1.2.8 spec/page_magic/driver_spec.rb
page_magic-1.2.8.alpha spec/page_magic/driver_spec.rb
page_magic-1.2.7 spec/page_magic/driver_spec.rb
page_magic-1.2.6 spec/page_magic/driver_spec.rb
page_magic-1.2.5 spec/page_magic/driver_spec.rb
page_magic-1.2.5.alpha1 spec/page_magic/driver_spec.rb
page_magic-1.2.4 spec/page_magic/driver_spec.rb
page_magic-1.2.3 spec/page_magic/driver_spec.rb