diff options
author | Robert Speicher <rspeicher@gmail.com> | 2015-04-21 18:06:26 -0400 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2015-04-25 14:41:06 -0400 |
commit | 6bac823ad4e7de25d478a96097386ecde3b1dc3b (patch) | |
tree | c92b9816cc4ced7c08408fea6bd46b355c3fb050 /spec | |
parent | a8e6656481fecce33339ab1e9ad42a6b9f0ed1bf (diff) | |
download | gitlab-ce-6bac823ad4e7de25d478a96097386ecde3b1dc3b.tar.gz |
Update CommitRangeReferenceFilter to use CommitRange class
Also matches CommitReferenceFilter's new behavior of always using short
SHAs in the link text.
Diffstat (limited to 'spec')
-rw-r--r-- | spec/lib/gitlab/markdown/commit_range_reference_filter_spec.rb | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/spec/lib/gitlab/markdown/commit_range_reference_filter_spec.rb b/spec/lib/gitlab/markdown/commit_range_reference_filter_spec.rb index 6bfe7bb3615..7274cb309a0 100644 --- a/spec/lib/gitlab/markdown/commit_range_reference_filter_spec.rb +++ b/spec/lib/gitlab/markdown/commit_range_reference_filter_spec.rb @@ -42,13 +42,17 @@ module Gitlab::Markdown reference = "#{commit1.short_id}...#{commit2.id}" reference2 = "#{commit1.id}...#{commit2.short_id}" - expect(filter("See #{reference}").css('a').first.text).to eq reference - expect(filter("See #{reference2}").css('a').first.text).to eq reference2 + exp = commit1.short_id + '...' + commit2.short_id + + expect(filter("See #{reference}").css('a').first.text).to eq exp + expect(filter("See #{reference2}").css('a').first.text).to eq exp end it 'links with adjacent text' do doc = filter("See (#{reference}.)") - expect(doc.to_html).to match(/\(<a.+>#{Regexp.escape(reference)}<\/a>\.\)/) + + exp = Regexp.escape("#{commit1.short_id}...#{commit2.short_id}") + expect(doc.to_html).to match(/\(<a.+>#{exp}<\/a>\.\)/) end it 'ignores invalid commit IDs' do @@ -107,7 +111,9 @@ module Gitlab::Markdown it 'links with adjacent text' do doc = filter("Fixed (#{reference}.)") - expect(doc.to_html).to match(/\(<a.+>#{Regexp.escape(reference)}<\/a>\.\)/) + + exp = Regexp.escape("#{project2.path_with_namespace}@#{commit1.short_id}...#{commit2.short_id}") + expect(doc.to_html).to match(/\(<a.+>#{exp}<\/a>\.\)/) end it 'ignores invalid commit IDs on the referenced project' do |