summaryrefslogtreecommitdiff
path: root/spec/models/commit_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/models/commit_spec.rb')
-rw-r--r--spec/models/commit_spec.rb16
1 files changed, 6 insertions, 10 deletions
diff --git a/spec/models/commit_spec.rb b/spec/models/commit_spec.rb
index 90be9324951..1aaa927c216 100644
--- a/spec/models/commit_spec.rb
+++ b/spec/models/commit_spec.rb
@@ -15,12 +15,12 @@ describe Commit do
describe '#to_reference' do
it 'returns a String reference to the object' do
- expect(commit.to_reference).to eq commit.id
+ expect(commit.to_reference).to eq commit.short_id
end
it 'supports a cross-project reference' do
cross = double('project')
- expect(commit.to_reference(cross)).to eq "#{project.to_reference}@#{commit.id}"
+ expect(commit.to_reference(cross)).to eq "#{project.to_reference}@#{commit.short_id}"
end
end
@@ -77,14 +77,10 @@ eos
let(:other_issue) { create :issue, project: other_project }
it 'detects issues that this commit is marked as closing' do
- allow(commit).to receive(:safe_message).and_return("Fixes ##{issue.iid}")
- expect(commit.closes_issues).to eq([issue])
- end
-
- it 'does not detect issues from other projects' do
ext_ref = "#{other_project.path_with_namespace}##{other_issue.iid}"
- allow(commit).to receive(:safe_message).and_return("Fixes #{ext_ref}")
- expect(commit.closes_issues).to be_empty
+ allow(commit).to receive(:safe_message).and_return("Fixes ##{issue.iid} and #{ext_ref}")
+ expect(commit.closes_issues).to include(issue)
+ expect(commit.closes_issues).to include(other_issue)
end
end
@@ -92,7 +88,7 @@ eos
subject { create(:project).commit }
let(:author) { create(:user, email: subject.author_email) }
- let(:backref_text) { "commit #{subject.id}" }
+ let(:backref_text) { "commit #{subject.short_id}" }
let(:set_mentionable_text) do
->(txt) { allow(subject).to receive(:safe_message).and_return(txt) }
end