diff options
author | Jarka Kadlecova <jarka@gitlab.com> | 2017-07-10 10:38:42 +0300 |
---|---|---|
committer | Jarka Kadlecova <jarka@gitlab.com> | 2017-07-24 09:13:43 +0300 |
commit | 7bee7b848aab883a6869e1fd2fbb9e66182d2023 (patch) | |
tree | 286029930e7c9af9402a752a1dd6f2ab9c607776 /spec/models/concerns | |
parent | 2fa22a07296223c1239bfab94654487cca222097 (diff) |
Support both internal and external issue trackers
Diffstat (limited to 'spec/models/concerns')
-rw-r--r-- | spec/models/concerns/mentionable_spec.rb | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/spec/models/concerns/mentionable_spec.rb b/spec/models/concerns/mentionable_spec.rb index e2a29e0ae70..1ad811736af 100644 --- a/spec/models/concerns/mentionable_spec.rb +++ b/spec/models/concerns/mentionable_spec.rb @@ -174,25 +174,25 @@ describe Commit, 'Mentionable' do it "is false when message doesn't reference anything" do allow(commit.raw).to receive(:message).and_return "WIP: Do something" - expect(commit.matches_cross_reference_regex?).to be false + expect(commit.matches_cross_reference_regex?).to be_falsey end it 'is true if issue #number mentioned in title' do allow(commit.raw).to receive(:message).and_return "#1" - expect(commit.matches_cross_reference_regex?).to be true + expect(commit.matches_cross_reference_regex?).to be_truthy end it 'is true if references an MR' do allow(commit.raw).to receive(:message).and_return "See merge request !12" - expect(commit.matches_cross_reference_regex?).to be true + expect(commit.matches_cross_reference_regex?).to be_truthy end it 'is true if references a commit' do allow(commit.raw).to receive(:message).and_return "a1b2c3d4" - expect(commit.matches_cross_reference_regex?).to be true + expect(commit.matches_cross_reference_regex?).to be_truthy end it 'is true if issue referenced by url' do @@ -200,7 +200,7 @@ describe Commit, 'Mentionable' do allow(commit.raw).to receive(:message).and_return Gitlab::UrlBuilder.build(issue) - expect(commit.matches_cross_reference_regex?).to be true + expect(commit.matches_cross_reference_regex?).to be_truthy end context 'with external issue tracker' do @@ -209,7 +209,13 @@ describe Commit, 'Mentionable' do it 'is true if external issues referenced' do allow(commit.raw).to receive(:message).and_return 'JIRA-123' - expect(commit.matches_cross_reference_regex?).to be true + expect(commit.matches_cross_reference_regex?).to be_truthy + end + + it 'is true if internal issues referenced' do + allow(commit.raw).to receive(:message).and_return '#123' + + expect(commit.matches_cross_reference_regex?).to be_truthy end end end |