From 26e34d90de9e44feec5599dee3015671a4ef62c5 Mon Sep 17 00:00:00 2001 From: Daniel Cunha Date: Thu, 29 Nov 2012 13:43:40 -0300 Subject: [PATCH] Building url for selenium driver --- app/models/environment.rb | 10 ++++------ lib/noosfero.rb | 5 +++-- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/app/models/environment.rb b/app/models/environment.rb index 9e36191..615d3e4 100644 --- a/app/models/environment.rb +++ b/app/models/environment.rb @@ -616,12 +616,10 @@ class Environment < ActiveRecord::Base end def top_url - protocol = 'http' - result = "#{protocol}://#{default_hostname}" - if Noosfero.url_options.has_key?(:port) - result << ':' << Noosfero.url_options[:port].to_s - end - result + url = 'http://' + url << (Noosfero.url_options.key?(:host) ? Noosfero.url_options[:host] : default_hostname) + url << ':' << Noosfero.url_options[:port].to_s if Noosfero.url_options.key?(:port) + url end def to_s diff --git a/lib/noosfero.rb b/lib/noosfero.rb index 5b4373c..f3c468e 100644 --- a/lib/noosfero.rb +++ b/lib/noosfero.rb @@ -81,8 +81,9 @@ module Noosfero def self.url_options if ENV['RAILS_ENV'] == 'development' development_url_options - # elsif ENV['RAILS_ENV'] == 'cucumber' - # Webrat.configuration.mode == :rails ? { :host => '' } : { :port => Webrat.configuration.application_port } + elsif ENV['RAILS_ENV'] == 'cucumber' + { :host => Capybara.current_session.driver.rack_server.host, + :port => Capybara.current_session.driver.rack_server.port } else {} end -- libgit2 0.21.2