diff options
author | Rémy Coutable <remy@rymai.me> | 2017-07-25 19:09:00 +0200 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2017-07-27 14:31:53 +0200 |
commit | cddc5cacfb833fbd188d2f5982381f66dd3eee3b (patch) | |
tree | de3e7bda37c8b7f0eb5586695d6d871484dc44e2 /spec/initializers | |
parent | ddccd24c1388dadc057ac3c4c0a49f3fea847292 (diff) | |
download | gitlab-ce-cddc5cacfb833fbd188d2f5982381f66dd3eee3b.tar.gz |
Use described_class when possible
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'spec/initializers')
-rw-r--r-- | spec/initializers/settings_spec.rb | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/spec/initializers/settings_spec.rb b/spec/initializers/settings_spec.rb index 61439ac9506..ebdabcf93f1 100644 --- a/spec/initializers/settings_spec.rb +++ b/spec/initializers/settings_spec.rb @@ -5,37 +5,37 @@ describe Settings do describe '#host_without_www' do context 'URL with protocol' do it 'returns the host' do - expect(Settings.host_without_www('http://foo.com')).to eq 'foo.com' - expect(Settings.host_without_www('http://www.foo.com')).to eq 'foo.com' - expect(Settings.host_without_www('http://secure.foo.com')).to eq 'secure.foo.com' - expect(Settings.host_without_www('http://www.gravatar.com/avatar/%{hash}?s=%{size}&d=identicon')).to eq 'gravatar.com' + expect(described_class.host_without_www('http://foo.com')).to eq 'foo.com' + expect(described_class.host_without_www('http://www.foo.com')).to eq 'foo.com' + expect(described_class.host_without_www('http://secure.foo.com')).to eq 'secure.foo.com' + expect(described_class.host_without_www('http://www.gravatar.com/avatar/%{hash}?s=%{size}&d=identicon')).to eq 'gravatar.com' - expect(Settings.host_without_www('https://foo.com')).to eq 'foo.com' - expect(Settings.host_without_www('https://www.foo.com')).to eq 'foo.com' - expect(Settings.host_without_www('https://secure.foo.com')).to eq 'secure.foo.com' - expect(Settings.host_without_www('https://secure.gravatar.com/avatar/%{hash}?s=%{size}&d=identicon')).to eq 'secure.gravatar.com' + expect(described_class.host_without_www('https://foo.com')).to eq 'foo.com' + expect(described_class.host_without_www('https://www.foo.com')).to eq 'foo.com' + expect(described_class.host_without_www('https://secure.foo.com')).to eq 'secure.foo.com' + expect(described_class.host_without_www('https://secure.gravatar.com/avatar/%{hash}?s=%{size}&d=identicon')).to eq 'secure.gravatar.com' end end context 'URL without protocol' do it 'returns the host' do - expect(Settings.host_without_www('foo.com')).to eq 'foo.com' - expect(Settings.host_without_www('www.foo.com')).to eq 'foo.com' - expect(Settings.host_without_www('secure.foo.com')).to eq 'secure.foo.com' - expect(Settings.host_without_www('www.gravatar.com/avatar/%{hash}?s=%{size}&d=identicon')).to eq 'gravatar.com' + expect(described_class.host_without_www('foo.com')).to eq 'foo.com' + expect(described_class.host_without_www('www.foo.com')).to eq 'foo.com' + expect(described_class.host_without_www('secure.foo.com')).to eq 'secure.foo.com' + expect(described_class.host_without_www('www.gravatar.com/avatar/%{hash}?s=%{size}&d=identicon')).to eq 'gravatar.com' end context 'URL with user/port' do it 'returns the host' do - expect(Settings.host_without_www('bob:pass@foo.com:8080')).to eq 'foo.com' - expect(Settings.host_without_www('bob:pass@www.foo.com:8080')).to eq 'foo.com' - expect(Settings.host_without_www('bob:pass@secure.foo.com:8080')).to eq 'secure.foo.com' - expect(Settings.host_without_www('bob:pass@www.gravatar.com:8080/avatar/%{hash}?s=%{size}&d=identicon')).to eq 'gravatar.com' + expect(described_class.host_without_www('bob:pass@foo.com:8080')).to eq 'foo.com' + expect(described_class.host_without_www('bob:pass@www.foo.com:8080')).to eq 'foo.com' + expect(described_class.host_without_www('bob:pass@secure.foo.com:8080')).to eq 'secure.foo.com' + expect(described_class.host_without_www('bob:pass@www.gravatar.com:8080/avatar/%{hash}?s=%{size}&d=identicon')).to eq 'gravatar.com' - expect(Settings.host_without_www('http://bob:pass@foo.com:8080')).to eq 'foo.com' - expect(Settings.host_without_www('http://bob:pass@www.foo.com:8080')).to eq 'foo.com' - expect(Settings.host_without_www('http://bob:pass@secure.foo.com:8080')).to eq 'secure.foo.com' - expect(Settings.host_without_www('http://bob:pass@www.gravatar.com:8080/avatar/%{hash}?s=%{size}&d=identicon')).to eq 'gravatar.com' + expect(described_class.host_without_www('http://bob:pass@foo.com:8080')).to eq 'foo.com' + expect(described_class.host_without_www('http://bob:pass@www.foo.com:8080')).to eq 'foo.com' + expect(described_class.host_without_www('http://bob:pass@secure.foo.com:8080')).to eq 'secure.foo.com' + expect(described_class.host_without_www('http://bob:pass@www.gravatar.com:8080/avatar/%{hash}?s=%{size}&d=identicon')).to eq 'gravatar.com' end end end |