Skip to content
Snippets Groups Projects
Commit a95eda6f authored by Jason Hollingsworth's avatar Jason Hollingsworth
Browse files

Fix broken test in spec/models/project_spec.rb

A test was broken if running on a non-standard port.
Made checking for (non-)standard port more robust.
Changed gitlab_on_non_standard_port to gitlab_on_standard_port (less negative).


Former-commit-id: 39a2adf4
parent 0457fc75
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -12,7 +12,7 @@ class Notify < ActionMailer::Base
 
default_url_options[:host] = Gitlab.config.gitlab.host
default_url_options[:protocol] = Gitlab.config.gitlab.protocol
default_url_options[:port] = Gitlab.config.gitlab.port if Gitlab.config.gitlab_on_non_standard_port?
default_url_options[:port] = Gitlab.config.gitlab.port unless Gitlab.config.gitlab_on_standard_port?
default_url_options[:script_name] = Gitlab.config.gitlab.relative_url_root
 
default from: Gitlab.config.gitlab.email_from
Loading
Loading
Loading
Loading
@@ -3,8 +3,8 @@ class Settings < Settingslogic
namespace Rails.env
 
class << self
def gitlab_on_non_standard_port?
![443, 80].include?(gitlab.port.to_i)
def gitlab_on_standard_port?
gitlab.port.to_i == (gitlab.https ? 443 : 80)
end
 
private
Loading
Loading
@@ -18,11 +18,7 @@ class Settings < Settingslogic
end
 
def build_gitlab_url
if gitlab_on_non_standard_port?
custom_port = ":#{gitlab.port}"
else
custom_port = nil
end
custom_port = gitlab_on_standard_port? ? nil : ":#{gitlab.port}"
[ gitlab.protocol,
"://",
gitlab.host,
Loading
Loading
Loading
Loading
@@ -101,7 +101,7 @@ describe Project do
 
it "returns the web URL without the protocol for this repo" do
project = Project.new(path: "somewhere")
project.web_url_without_protocol.should == "#{Gitlab.config.gitlab.host}/somewhere"
project.web_url_without_protocol.should == "#{Gitlab.config.gitlab.url.split("://")[1]}/somewhere"
end
 
describe "last_activity methods" do
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment