summaryrefslogtreecommitdiff
path: root/spec/models/issue_spec.rb
diff options
context:
space:
mode:
authorZeger-Jan van de Weg <zegerjan@gitlab.com>2016-04-13 21:20:03 +0200
committerZeger-Jan van de Weg <zegerjan@gitlab.com>2016-04-14 14:49:45 +0200
commit0385cd5a585572be4d3b72797c14cad23efc48f5 (patch)
tree3f3f3e7d422b0b0a27e2042d7c8c0929af75cbe4 /spec/models/issue_spec.rb
parentc0678f2d281242601560e2646cab1aa8a349c4bb (diff)
downloadgitlab-ce-0385cd5a585572be4d3b72797c14cad23efc48f5.tar.gz
Start with iid on branch creation
Diffstat (limited to 'spec/models/issue_spec.rb')
-rw-r--r--spec/models/issue_spec.rb17
1 files changed, 12 insertions, 5 deletions
diff --git a/spec/models/issue_spec.rb b/spec/models/issue_spec.rb
index 15052aaca28..fac516f9568 100644
--- a/spec/models/issue_spec.rb
+++ b/spec/models/issue_spec.rb
@@ -191,12 +191,19 @@ describe Issue, models: true do
end
describe '#related_branches' do
- it "selects the right branches" do
+ it 'selects the right branches' do
allow(subject.project.repository).to receive(:branch_names).
- and_return(["mpempe", "#{subject.iid}mepmep", subject.to_branch_name])
+ and_return(['mpempe', "#{subject.iid}mepmep", subject.to_branch_name])
expect(subject.related_branches).to eq([subject.to_branch_name])
end
+
+ it 'excludes stable branches from the related branches' do
+ allow(subject.project.repository).to receive(:branch_names).
+ and_return(["#{subject.iid}-0-stable"])
+
+ expect(subject.related_branches).to eq []
+ end
end
it_behaves_like 'an editable mentionable' do
@@ -210,11 +217,11 @@ describe Issue, models: true do
let(:subject) { create :issue }
end
- describe "#to_branch_name" do
+ describe '#to_branch_name' do
let(:issue) { create(:issue, title: 'a' * 30) }
- it "starts with the issue iid" do
- expect(issue.to_branch_name).to match /-#{issue.iid}\z/
+ it 'starts with the issue iid' do
+ expect(issue.to_branch_name).to match /\A#{issue.iid}-a+\z/
end
end
end