Commit 39a2adf4f49981dda9ab3e0d6a23b74acccbe128

Authored by Jason Hollingsworth
1 parent ced4a37a

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).
app/mailers/notify.rb
@@ -12,7 +12,7 @@ class Notify < ActionMailer::Base @@ -12,7 +12,7 @@ class Notify < ActionMailer::Base
12 12
13 default_url_options[:host] = Gitlab.config.gitlab.host 13 default_url_options[:host] = Gitlab.config.gitlab.host
14 default_url_options[:protocol] = Gitlab.config.gitlab.protocol 14 default_url_options[:protocol] = Gitlab.config.gitlab.protocol
15 - default_url_options[:port] = Gitlab.config.gitlab.port if Gitlab.config.gitlab_on_non_standard_port? 15 + default_url_options[:port] = Gitlab.config.gitlab.port unless Gitlab.config.gitlab_on_standard_port?
16 default_url_options[:script_name] = Gitlab.config.gitlab.relative_url_root 16 default_url_options[:script_name] = Gitlab.config.gitlab.relative_url_root
17 17
18 default from: Gitlab.config.gitlab.email_from 18 default from: Gitlab.config.gitlab.email_from
config/initializers/1_settings.rb
@@ -3,8 +3,8 @@ class Settings < Settingslogic @@ -3,8 +3,8 @@ class Settings < Settingslogic
3 namespace Rails.env 3 namespace Rails.env
4 4
5 class << self 5 class << self
6 - def gitlab_on_non_standard_port?  
7 - ![443, 80].include?(gitlab.port.to_i) 6 + def gitlab_on_standard_port?
  7 + gitlab.port.to_i == (gitlab.https ? 443 : 80)
8 end 8 end
9 9
10 private 10 private
@@ -18,11 +18,7 @@ class Settings &lt; Settingslogic @@ -18,11 +18,7 @@ class Settings &lt; Settingslogic
18 end 18 end
19 19
20 def build_gitlab_url 20 def build_gitlab_url
21 - if gitlab_on_non_standard_port?  
22 - custom_port = ":#{gitlab.port}"  
23 - else  
24 - custom_port = nil  
25 - end 21 + custom_port = gitlab_on_standard_port? ? nil : ":#{gitlab.port}"
26 [ gitlab.protocol, 22 [ gitlab.protocol,
27 "://", 23 "://",
28 gitlab.host, 24 gitlab.host,
spec/models/project_spec.rb
@@ -101,7 +101,7 @@ describe Project do @@ -101,7 +101,7 @@ describe Project do
101 101
102 it "returns the web URL without the protocol for this repo" do 102 it "returns the web URL without the protocol for this repo" do
103 project = Project.new(path: "somewhere") 103 project = Project.new(path: "somewhere")
104 - project.web_url_without_protocol.should == "#{Gitlab.config.gitlab.host}/somewhere" 104 + project.web_url_without_protocol.should == "#{Gitlab.config.gitlab.url.split("://")[1]}/somewhere"
105 end 105 end
106 106
107 describe "last_activity methods" do 107 describe "last_activity methods" do