diff options
author | Stan Hu <stanhu@gmail.com> | 2016-06-30 22:12:16 +0300 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2016-07-01 19:10:12 +0300 |
commit | 4bfe10d5f972c64241cfdd0393d4d55a63092dc4 (patch) | |
tree | 802f991838cd46d5ee299cedbcc7260b71bb38aa /spec | |
parent | 6c0d3b4cf3847b78b89170ccb0d8a1e5ebdc48d6 (diff) |
Fix emoji paths in relative root configurations
If a site specifies a relative URL root, emoji files would omit the path from
the URL, leading to lots of 404s.
Closes #15642
Diffstat (limited to 'spec')
-rw-r--r-- | spec/lib/gitlab/award_emoji_spec.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/spec/lib/gitlab/award_emoji_spec.rb b/spec/lib/gitlab/award_emoji_spec.rb index 0f3852b1729..00a110e31f8 100644 --- a/spec/lib/gitlab/award_emoji_spec.rb +++ b/spec/lib/gitlab/award_emoji_spec.rb @@ -2,6 +2,10 @@ require 'spec_helper' describe Gitlab::AwardEmoji do describe '.urls' do + after do + Gitlab::AwardEmoji.instance_variable_set(:@urls, nil) + end + subject { Gitlab::AwardEmoji.urls } it { is_expected.to be_an_instance_of(Array) } @@ -15,6 +19,17 @@ describe Gitlab::AwardEmoji do end end end + + context 'handles relative root' do + it 'includes the full path' do + allow(Gitlab::Application.config).to receive(:relative_url_root).and_return('/gitlab') + + subject.each do |hash| + expect(hash[:name]).to be_an_instance_of(String) + expect(hash[:path]).to start_with('/gitlab') + end + end + end end describe '.emoji_by_category' do |