Module: Sauce::Capybara

Defined in:
lib/sauce/capybara.rb

Defined Under Namespace

Classes: Driver

Class Method Summary collapse

Class Method Details

.configure_capybaraObject



131
132
133
134
135
136
137
138
139
140
141
142
# File 'lib/sauce/capybara.rb', line 131

def self.configure_capybara
  ::Capybara.configure do |config|
    if Sauce::Config.new[:start_local_application]
      config.server_port = Sauce::Config.get_application_port
    end
    begin
      #config.always_include_port = true
    rescue
      # This option is only in Capybara 2+
    end
  end
end

.configure_capybara_for_rspecObject



144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
# File 'lib/sauce/capybara.rb', line 144

def self.configure_capybara_for_rspec
  begin
    require "rspec/core"
    ::RSpec.configure do |config|
      config.before :suite do 
        ::Capybara.configure do |capy_config|
          sauce_config = Sauce::Config.new
          if capy_config.app_host.nil?
            if sauce_config[:start_local_application]
              host = sauce_config[:application_host] || "127.0.0.1"
              port = sauce_config[:application_port]
              capy_config.app_host = "http://#{host}:#{port}"
              capy_config.run_server = false
            end
          end
        end
      end
    end
  rescue LoadError => e
    # User is not using RSpec
  end
end