diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-22 18:06:06 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-22 18:06:06 +0300 |
commit | 6653aab95dfdfd260e8814e7499cc2345f451f99 (patch) | |
tree | 695acdeb5be70a87a26e39a592dd302f29d1c1fc /spec/models/issue_spec.rb | |
parent | b1bcdba89bc241e2cede910f26cf3f5fff8d7901 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models/issue_spec.rb')
-rw-r--r-- | spec/models/issue_spec.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/spec/models/issue_spec.rb b/spec/models/issue_spec.rb index 18a1a30eee5..0f78cb4d9b1 100644 --- a/spec/models/issue_spec.rb +++ b/spec/models/issue_spec.rb @@ -423,6 +423,19 @@ describe Issue do issue = create(:issue, title: 'testing-issue', confidential: true) expect(issue.to_branch_name).to match /confidential-issue\z/ end + + context 'issue title longer than 100 characters' do + let(:issue) { create(:issue, iid: 999, title: 'Lorem ipsum dolor sit amet consectetur adipiscing elit Mauris sit amet ipsum id lacus custom fringilla convallis') } + + it "truncates branch name to at most 100 characters" do + expect(issue.to_branch_name.length).to be <= 100 + end + + it "truncates dangling parts of the branch name" do + # 100 characters would've got us "999-lorem...lacus-custom-fri". + expect(issue.to_branch_name).to eq("999-lorem-ipsum-dolor-sit-amet-consectetur-adipiscing-elit-mauris-sit-amet-ipsum-id-lacus-custom") + end + end end describe '#can_be_worked_on?' do |