Commit 26e34d90de9e44feec5599dee3015671a4ef62c5
Committed by
Daniela Feitosa
1 parent
e4defc23
Exists in
master
and in
22 other branches
Building url for selenium driver
Showing
2 changed files
with
7 additions
and
8 deletions
Show diff stats
app/models/environment.rb
| @@ -616,12 +616,10 @@ class Environment < ActiveRecord::Base | @@ -616,12 +616,10 @@ class Environment < ActiveRecord::Base | ||
| 616 | end | 616 | end |
| 617 | 617 | ||
| 618 | def top_url | 618 | def top_url |
| 619 | - protocol = 'http' | ||
| 620 | - result = "#{protocol}://#{default_hostname}" | ||
| 621 | - if Noosfero.url_options.has_key?(:port) | ||
| 622 | - result << ':' << Noosfero.url_options[:port].to_s | ||
| 623 | - end | ||
| 624 | - result | 619 | + url = 'http://' |
| 620 | + url << (Noosfero.url_options.key?(:host) ? Noosfero.url_options[:host] : default_hostname) | ||
| 621 | + url << ':' << Noosfero.url_options[:port].to_s if Noosfero.url_options.key?(:port) | ||
| 622 | + url | ||
| 625 | end | 623 | end |
| 626 | 624 | ||
| 627 | def to_s | 625 | def to_s |
lib/noosfero.rb
| @@ -81,8 +81,9 @@ module Noosfero | @@ -81,8 +81,9 @@ module Noosfero | ||
| 81 | def self.url_options | 81 | def self.url_options |
| 82 | if ENV['RAILS_ENV'] == 'development' | 82 | if ENV['RAILS_ENV'] == 'development' |
| 83 | development_url_options | 83 | development_url_options |
| 84 | - # elsif ENV['RAILS_ENV'] == 'cucumber' | ||
| 85 | - # Webrat.configuration.mode == :rails ? { :host => '' } : { :port => Webrat.configuration.application_port } | 84 | + elsif ENV['RAILS_ENV'] == 'cucumber' |
| 85 | + { :host => Capybara.current_session.driver.rack_server.host, | ||
| 86 | + :port => Capybara.current_session.driver.rack_server.port } | ||
| 86 | else | 87 | else |
| 87 | {} | 88 | {} |
| 88 | end | 89 | end |