Sha256: 4a6958a1b17c1ee1615e737c8639e948be7479051115f9f12cbe248edc231590

Contents?: true

Size: 892 Bytes

Versions: 4

Compression:

Stored size: 892 Bytes

Contents

require 'spec_helper'

describe PageMagic::Browser do
  let(:app) { Object.new }

  before do
    PageMagic::Browser.instance_variable_set(:@session, nil)
    app.extend PageMagic::Browser
  end

  describe 'default' do
    it 'should be firefox' do
      PageMagic::Browser.default.should == :firefox
    end
  end

  describe 'browser' do
    it 'should return the existing session' do
      session_instance = app.browser
      app.browser.should == session_instance
    end

    it 'should create a session if not already set' do
      new_session = double(:new_session)

      PageMagic.should_receive(:session).with(:firefox).and_return new_session
      app.browser.should == new_session
    end

    it 'should use custom browser' do
      PageMagic.should_receive(:session).with(:custom_browser)

      PageMagic::Browser.default = :custom_browser
      app.browser
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
page_magic-0.11.0.alpha spec/browser_spec.rb
page_magic-0.10.0 spec/browser_spec.rb
page_magic-0.9.6 spec/browser_spec.rb
page_magic-0.9.5 spec/browser_spec.rb