Sha256: 57283d5728d4f5312232728552dc6b4d7a56e6508d1b55564cda10c38811e080

Contents?: true

Size: 1.03 KB

Versions: 4

Compression:

Stored size: 1.03 KB

Contents

describe 'PageMagic.session' do

  let(:app_class) do
    Class.new do
      def call env
        [200, {}, ["hello world!!"]]
      end
    end
  end

  def registered_driver browser
    Capybara.drivers[browser].call(nil)
  end

  context 'specificying a browser' do
    it 'loads the driver for the specified browser' do
      session = PageMagic.session(browser: :firefox)
      session.raw_session.driver.is_a?(Capybara::Selenium::Driver).should be_true
    end
  end

  context 'testing against rack applications' do

    it 'requires the app to be supplied' do
      session = PageMagic.session(application: app_class.new)
      session.raw_session.visit('/')
      session.raw_session.text.should == 'hello world!!'
    end

    it 'can run against an rack application using a particular browser' do
      session = PageMagic.session(browser: :rack_test, application: app_class.new)
      session.raw_session.mode.should == :rack_test
      session.raw_session.visit('/')
      session.raw_session.text.should == 'hello world!!'
    end
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
page_magic-1.0.0.alpha4 spec/page_magic/usage/starting_a_session_spec.rb
page_magic-1.0.0.alpha3 spec/page_magic/usage/starting_a_session_spec.rb
page_magic-0.11.0.alpha8 spec/page_magic/usage/starting_a_session_spec.rb
page_magic-0.11.0.alpha7 spec/page_magic/usage/starting_a_session_spec.rb