diff options
author | Robert Speicher <rspeicher@gmail.com> | 2015-05-12 17:58:29 -0400 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2015-05-26 15:48:31 -0400 |
commit | 136ab73803850c10588b369862b1e5524849d31c (patch) | |
tree | 202968fc761b306920f04976fed18b80d2701dfa /spec | |
parent | 9d032cddf5575e2233c81142a3ebc609cd43a47e (diff) | |
download | gitlab-ce-136ab73803850c10588b369862b1e5524849d31c.tar.gz |
Update CommitRange#to_reference to use full SHAs
We only want them shortened by the filter, which calls to_s
Diffstat (limited to 'spec')
-rw-r--r-- | spec/lib/gitlab/markdown/commit_range_reference_filter_spec.rb | 3 | ||||
-rw-r--r-- | spec/models/commit_range_spec.rb | 26 |
2 files changed, 14 insertions, 15 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 7274cb309a0..1593088a094 100644 --- a/spec/lib/gitlab/markdown/commit_range_reference_filter_spec.rb +++ b/spec/lib/gitlab/markdown/commit_range_reference_filter_spec.rb @@ -9,8 +9,7 @@ module Gitlab::Markdown let(:commit2) { project.commit("HEAD~2") } it 'requires project context' do - expect { described_class.call('Commit Range 1c002d..d200c1', {}) }. - to raise_error(ArgumentError, /:project/) + expect { described_class.call('') }.to raise_error(ArgumentError, /:project/) end %w(pre code a style).each do |elem| diff --git a/spec/models/commit_range_spec.rb b/spec/models/commit_range_spec.rb index 2d347a335a1..e7fb43ff335 100644 --- a/spec/models/commit_range_spec.rb +++ b/spec/models/commit_range_spec.rb @@ -1,6 +1,12 @@ require 'spec_helper' describe CommitRange do + describe 'modules' do + subject { described_class } + + it { is_expected.to include_module(Referable) } + end + let(:sha_from) { 'f3f85602' } let(:sha_to) { 'e86e1013' } @@ -11,10 +17,14 @@ describe CommitRange do expect { described_class.new("Foo") }.to raise_error end - describe 'modules' do - subject { described_class } + describe '#to_s' do + it 'is correct for three-dot syntax' do + expect(range.to_s).to eq "#{sha_from[0..7]}...#{sha_to[0..7]}" + end - it { is_expected.to include_module(Referable) } + it 'is correct for two-dot syntax' do + expect(range2.to_s).to eq "#{sha_from[0..7]}..#{sha_to[0..7]}" + end end describe '#to_reference' do @@ -34,16 +44,6 @@ describe CommitRange do end end - describe '#to_s' do - it 'is correct for three-dot syntax' do - expect(range.to_s).to eq "#{sha_from[0..7]}...#{sha_to[0..7]}" - end - - it 'is correct for two-dot syntax' do - expect(range2.to_s).to eq "#{sha_from[0..7]}..#{sha_to[0..7]}" - end - end - describe '#reference_title' do it 'returns the correct String for three-dot ranges' do expect(range.reference_title).to eq "Commits #{sha_from} through #{sha_to}" |