Sha256: e502b9d420c4ac0b013c6ca1774ebde1faef047a640c5485a8a8b0926b1c2d8a

Contents?: true

Size: 1.6 KB

Versions: 17

Compression:

Stored size: 1.6 KB

Contents

class Volt
  def self.spec_setup(app_path='.')
    if RUBY_PLATFORM == 'opal'
      require 'volt'
    else
      ENV['SERVER'] = 'true'

      if ENV['BROWSER']
        require 'capybara'
        require 'capybara/dsl'
        require 'capybara/rspec'
        require 'capybara/poltergeist'
      end

      require 'volt'
      require 'volt/boot'

      # Require in app
      Volt.boot(Dir.pwd)

      if ENV['BROWSER']
        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

        if ENV['BROWSER'] == 'phantom'
          Capybara.default_driver = :poltergeist
        elsif ENV['BROWSER'] == 'chrome'
          Capybara.register_driver :chrome do |app|
            Capybara::Selenium::Driver.new(app, :browser => :chrome)
          end

          Capybara.default_driver = :chrome
        elsif ENV['BROWSER'] == 'firefox'

          # require 'selenium/webdriver'
          # # require 'selenium/client'
          #
          Capybara.default_driver = :selenium

          # Capybara.register_driver :selenium_firefox do |app|
          #   Capybara::Selenium::Driver.new(app, :browser => :firefox)
          # end
          # Capybara.current_driver = :selenium_firefox
        elsif ENV['BROWSER'] == 'safari'
          # Needs extension
          Capybara.register_driver :safari do |app|
            Capybara::Selenium::Driver.new(app, :browser => :safari)
          end
          Capybara.default_driver = :safari
        end
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
volt-0.8.14 lib/volt/spec/setup.rb
volt-0.8.13 lib/volt/spec/setup.rb
volt-0.8.11 lib/volt/spec/setup.rb
volt-0.8.10 lib/volt/spec/setup.rb
volt-0.8.9 lib/volt/spec/setup.rb
volt-0.8.8 lib/volt/spec/setup.rb
volt-0.8.7 lib/volt/spec/setup.rb
volt-0.8.6 lib/volt/spec/setup.rb
volt-0.8.5 lib/volt/spec/setup.rb
volt-0.8.4 lib/volt/spec/setup.rb
volt-0.8.3 lib/volt/spec/setup.rb
volt-0.8.2 lib/volt/spec/setup.rb
volt-0.8.1 lib/volt/spec/setup.rb
volt-0.8.0 lib/volt/spec/setup.rb
volt-0.7.23 lib/volt/spec/setup.rb
volt-0.7.22 lib/volt/spec/setup.rb
volt-0.7.21 lib/volt/spec/setup.rb