fix default host for tests

Change-Id: I88b59c05a39803c95e3d306b9f47b7ef0450d4c8
Reviewed-on: https://gerrit.instructure.com/2429
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
This commit is contained in:
JT Olds 2011-02-24 14:00:45 -07:00
parent 0dc9cb5b62
commit bedb1d878e
2 changed files with 13 additions and 2 deletions

View File

@ -44,11 +44,18 @@ class HostUrl
res = @@file_host = @@domain_config[:files_domain] if @@domain_config && @@domain_config.has_key?(:files_domain)
Rails.logger.warn("No separate files host specified for account id #{account.id}. This is a potential security risk.") unless res
end
res ||= default_host
res ||= @@file_host = default_host
end
def outgoing_email_address(preferred_user="notifications")
@outgoing_email_address.presence || "#{preferred_user}@#{outgoing_email_domain}"
end
def file_host=(val)
@@file_host = val
end
def default_host=(val)
@@default_host = val
end
end
end

View File

@ -36,11 +36,12 @@ module SeleniumTestsHelperMethods
end
def self.start_webrick_server
HostUrl.default_host = "#{SERVER_IP}:#{SERVER_PORT}"
HostUrl.file_host = "#{SERVER_IP}:#{SERVER_PORT}"
server = SpecFriendlyWEBrickServer
app = Rack::Builder.new do
use Rails::Rack::Debugger
map '/' do
use Rails::Rack::Static
run ActionController::Dispatcher.new
end
@ -48,7 +49,10 @@ module SeleniumTestsHelperMethods
server.run(app, :Port => SERVER_PORT, :AccessLog => [])
shutdown = lambda do
server.shutdown
HostUrl.default_host = nil
HostUrl.file_host = nil
end
at_exit { shutdown.call }
return shutdown
end
end