Sha256: d70805dd887668de9e9ef44903b5b3713e03d1f5f44be33149679e1703fad0fa

Contents?: true

Size: 1.03 KB

Versions: 9

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

9 entries across 9 versions & 1 rubygems

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