summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimothy Andrew <mail@timothyandrew.net>2016-04-12 16:01:44 +0530
committerTimothy Andrew <mail@timothyandrew.net>2016-04-12 16:01:44 +0530
commit66ca80181bcb5aef97296fde567b899603186be6 (patch)
tree38005cc5f3b89ec301c102b7739b17cc63943fe4
parent91034af3c998ce4a4f83281525304e8c50add384 (diff)
downloadgitlab-ce-66ca80181bcb5aef97296fde567b899603186be6.tar.gz
Test the `Issue#to_branch_name` method.
-rw-r--r--spec/models/issue_spec.rb13
1 files changed, 11 insertions, 2 deletions
diff --git a/spec/models/issue_spec.rb b/spec/models/issue_spec.rb
index 8cacce6a7bf..22dabaa0404 100644
--- a/spec/models/issue_spec.rb
+++ b/spec/models/issue_spec.rb
@@ -228,10 +228,19 @@ describe Issue, models: true do
end
describe "#to_branch_name" do
- let(:issue) { create(:issue, title: 'a' * 30) }
+ let(:issue) { create(:issue, title: 'testing-issue') }
- it "starts with the issue iid" do
+ it "ends with the issue iid" do
expect(issue.to_branch_name).to match /-#{issue.iid}\z/
end
+
+ it "contains the issue title if not confidential" do
+ expect(issue.to_branch_name).to match /\Atesting-issue/
+ end
+
+ it "does not contain the issue title if confidential" do
+ issue = create(:issue, title: 'testing-issue', confidential: true)
+ expect(issue.to_branch_name).to match /\Aissue/
+ end
end
end