diff options
author | Robert Speicher <rspeicher@gmail.com> | 2015-05-21 23:35:15 +0300 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2015-05-26 22:49:22 +0300 |
commit | 5a9c5520d9e63a38ed8b839be8430a5b5815da67 (patch) | |
tree | 9419a59b0eb796e77688871a19a8c20daf2809b5 /spec/lib/gitlab/closing_issue_extractor_spec.rb | |
parent | 68f74aa82690ca83faf81654737f7d0caefdfbd3 (diff) |
Make use of to_reference in more specs
Diffstat (limited to 'spec/lib/gitlab/closing_issue_extractor_spec.rb')
-rw-r--r-- | spec/lib/gitlab/closing_issue_extractor_spec.rb | 70 |
1 files changed, 35 insertions, 35 deletions
diff --git a/spec/lib/gitlab/closing_issue_extractor_spec.rb b/spec/lib/gitlab/closing_issue_extractor_spec.rb index cb7b0fbb890..63d474c0d1e 100644 --- a/spec/lib/gitlab/closing_issue_extractor_spec.rb +++ b/spec/lib/gitlab/closing_issue_extractor_spec.rb @@ -1,131 +1,131 @@ require 'spec_helper' describe Gitlab::ClosingIssueExtractor do - let(:project) { create(:project) } - let(:issue) { create(:issue, project: project) } - let(:iid1) { issue.iid } + let(:project) { create(:project) } + let(:issue) { create(:issue, project: project) } + let(:reference) { issue.to_reference } subject { described_class.new(project, project.creator) } describe "#closed_by_message" do context 'with a single reference' do it do - message = "Awesome commit (Closes ##{iid1})" + message = "Awesome commit (Closes #{reference})" expect(subject.closed_by_message(message)).to eq([issue]) end it do - message = "Awesome commit (closes ##{iid1})" + message = "Awesome commit (closes #{reference})" expect(subject.closed_by_message(message)).to eq([issue]) end it do - message = "Closed ##{iid1}" + message = "Closed #{reference}" expect(subject.closed_by_message(message)).to eq([issue]) end it do - message = "closed ##{iid1}" + message = "closed #{reference}" expect(subject.closed_by_message(message)).to eq([issue]) end it do - message = "Closing ##{iid1}" + message = "Closing #{reference}" expect(subject.closed_by_message(message)).to eq([issue]) end it do - message = "closing ##{iid1}" + message = "closing #{reference}" expect(subject.closed_by_message(message)).to eq([issue]) end it do - message = "Close ##{iid1}" + message = "Close #{reference}" expect(subject.closed_by_message(message)).to eq([issue]) end it do - message = "close ##{iid1}" + message = "close #{reference}" expect(subject.closed_by_message(message)).to eq([issue]) end it do - message = "Awesome commit (Fixes ##{iid1})" + message = "Awesome commit (Fixes #{reference})" expect(subject.closed_by_message(message)).to eq([issue]) end it do - message = "Awesome commit (fixes ##{iid1})" + message = "Awesome commit (fixes #{reference})" expect(subject.closed_by_message(message)).to eq([issue]) end it do - message = "Fixed ##{iid1}" + message = "Fixed #{reference}" expect(subject.closed_by_message(message)).to eq([issue]) end it do - message = "fixed ##{iid1}" + message = "fixed #{reference}" expect(subject.closed_by_message(message)).to eq([issue]) end it do - message = "Fixing ##{iid1}" + message = "Fixing #{reference}" expect(subject.closed_by_message(message)).to eq([issue]) end it do - message = "fixing ##{iid1}" + message = "fixing #{reference}" expect(subject.closed_by_message(message)).to eq([issue]) end it do - message = "Fix ##{iid1}" + message = "Fix #{reference}" expect(subject.closed_by_message(message)).to eq([issue]) end it do - message = "fix ##{iid1}" + message = "fix #{reference}" expect(subject.closed_by_message(message)).to eq([issue]) end it do - message = "Awesome commit (Resolves ##{iid1})" + message = "Awesome commit (Resolves #{reference})" expect(subject.closed_by_message(message)).to eq([issue]) end it do - message = "Awesome commit (resolves ##{iid1})" + message = "Awesome commit (resolves #{reference})" expect(subject.closed_by_message(message)).to eq([issue]) end it do - message = "Resolved ##{iid1}" + message = "Resolved #{reference}" expect(subject.closed_by_message(message)).to eq([issue]) end it do - message = "resolved ##{iid1}" + message = "resolved #{reference}" expect(subject.closed_by_message(message)).to eq([issue]) end it do - message = "Resolving ##{iid1}" + message = "Resolving #{reference}" expect(subject.closed_by_message(message)).to eq([issue]) end it do - message = "resolving ##{iid1}" + message = "resolving #{reference}" expect(subject.closed_by_message(message)).to eq([issue]) end it do - message = "Resolve ##{iid1}" + message = "Resolve #{reference}" expect(subject.closed_by_message(message)).to eq([issue]) end it do - message = "resolve ##{iid1}" + message = "resolve #{reference}" expect(subject.closed_by_message(message)).to eq([issue]) end end @@ -133,40 +133,40 @@ describe Gitlab::ClosingIssueExtractor do context 'with multiple references' do let(:other_issue) { create(:issue, project: project) } let(:third_issue) { create(:issue, project: project) } - let(:iid2) { other_issue.iid } - let(:iid3) { third_issue.iid } + let(:reference2) { other_issue.to_reference } + let(:reference3) { third_issue.to_reference } it 'fetches issues in single line message' do - message = "Closes ##{iid1} and fix ##{iid2}" + message = "Closes #{reference} and fix ##{reference2}" expect(subject.closed_by_message(message)). to eq([issue, other_issue]) end it 'fetches comma-separated issues references in single line message' do - message = "Closes ##{iid1}, closes ##{iid2}" + message = "Closes #{reference}, closes ##{reference2}" expect(subject.closed_by_message(message)). to eq([issue, other_issue]) end it 'fetches comma-separated issues numbers in single line message' do - message = "Closes ##{iid1}, ##{iid2} and ##{iid3}" + message = "Closes #{reference}, ##{reference2} and ##{reference3}" expect(subject.closed_by_message(message)). to eq([issue, other_issue, third_issue]) end it 'fetches issues in multi-line message' do - message = "Awesome commit (closes ##{iid1})\nAlso fixes ##{iid2}" + message = "Awesome commit (closes #{reference})\nAlso fixes ##{reference2}" expect(subject.closed_by_message(message)). to eq([issue, other_issue]) end it 'fetches issues in hybrid message' do - message = "Awesome commit (closes ##{iid1})\n"\ - "Also fixing issues ##{iid2}, ##{iid3} and #4" + message = "Awesome commit (closes #{reference})\n"\ + "Also fixing issues ##{reference2}, ##{reference3} and #4" expect(subject.closed_by_message(message)). to eq([issue, other_issue, third_issue]) |