Sha256: ff370eb0e6b3ce74f76f86004dae64f6de39b3ed567cdf3045d1ace48c3d0feb

Contents?: true

Size: 1.1 KB

Versions: 16

Compression:

Stored size: 1.1 KB

Contents

require 'volt/spec/sauce_labs'

module Volt
  class << self
    def setup_capybara(app_path)
      browser = ENV['BROWSER']

      if browser
        setup_capybara_app(app_path)

        case browser
        when 'phantom'
          Capybara.default_driver = :poltergeist
        when 'chrome', 'safari'
          # Use the browser name, note that safari requires an extension to run
          browser = browser.to_sym
          Capybara.register_driver(browser) do |app|
            Capybara::Selenium::Driver.new(app, browser: browser)
          end

          Capybara.default_driver = browser
        when 'firefox'
          Capybara.default_driver = :selenium
        when 'sauce'
          setup_sauce_labs
        end
      end
    end

    def setup_capybara_app(app_path)
      require 'capybara'
      require 'capybara/dsl'
      require 'capybara/rspec'
      require 'capybara/poltergeist'
      require 'volt/server'

      Capybara.server do |app, port|
        require 'rack/handler/thin'
        Rack::Handler::Thin.run(app, Port: port)
      end

      Capybara.app = Server.new(app_path).app
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
volt-0.9.1.pre1 lib/volt/spec/capybara.rb
volt-0.9.0 lib/volt/spec/capybara.rb
volt-0.9.0.pre7 lib/volt/spec/capybara.rb
volt-0.9.0.pre6 lib/volt/spec/capybara.rb
volt-0.9.0.pre5 lib/volt/spec/capybara.rb
volt-0.9.0.pre4 lib/volt/spec/capybara.rb
volt-0.9.0.pre3 lib/volt/spec/capybara.rb
volt-0.9.0.pre2 lib/volt/spec/capybara.rb
volt-0.9.0.pre1 lib/volt/spec/capybara.rb
volt-0.8.27.beta9 lib/volt/spec/capybara.rb
volt-0.8.27.beta8 lib/volt/spec/capybara.rb
volt-0.8.27.beta7 lib/volt/spec/capybara.rb
volt-0.8.27.beta6 lib/volt/spec/capybara.rb
volt-0.8.27.beta5 lib/volt/spec/capybara.rb
volt-0.8.27.beta4 lib/volt/spec/capybara.rb
volt-0.8.27.beta3 lib/volt/spec/capybara.rb