diff options
author | Felipe Artur <felipefac@gmail.com> | 2016-10-07 01:05:27 +0300 |
---|---|---|
committer | Felipe Artur <felipefac@gmail.com> | 2016-10-19 18:46:04 +0300 |
commit | 8e4301d982ce28d80e711865ac294a98ddce3ec6 (patch) | |
tree | 1f6d01b142ca952f3cd3098336fbb0762fe0a8dc /spec/models/project_services | |
parent | f560849941dcb4408350c6c24034f845d3986782 (diff) |
Prevent wrong markdown on issue ids when project has Jira service activated
Diffstat (limited to 'spec/models/project_services')
-rw-r--r-- | spec/models/project_services/jira_service_spec.rb | 9 | ||||
-rw-r--r-- | spec/models/project_services/redmine_service_spec.rb | 8 |
2 files changed, 17 insertions, 0 deletions
diff --git a/spec/models/project_services/jira_service_spec.rb b/spec/models/project_services/jira_service_spec.rb index b48a3176007..6ff32aea018 100644 --- a/spec/models/project_services/jira_service_spec.rb +++ b/spec/models/project_services/jira_service_spec.rb @@ -30,6 +30,15 @@ describe JiraService, models: true do end end + describe '#reference_pattern' do + it_behaves_like 'allows project key on reference pattern' + + it 'does not allow # on the code' do + expect(subject.reference_pattern.match('#123')).to be_nil + expect(subject.reference_pattern.match('1#23#12')).to be_nil + end + end + describe "Execute" do let(:user) { create(:user) } let(:project) { create(:project) } diff --git a/spec/models/project_services/redmine_service_spec.rb b/spec/models/project_services/redmine_service_spec.rb index b8679cd2563..0a7b237a051 100644 --- a/spec/models/project_services/redmine_service_spec.rb +++ b/spec/models/project_services/redmine_service_spec.rb @@ -26,4 +26,12 @@ describe RedmineService, models: true do it { is_expected.not_to validate_presence_of(:new_issue_url) } end end + + describe '#reference_pattern' do + it_behaves_like 'allows project key on reference pattern' + + it 'does allow # on the reference' do + expect(subject.reference_pattern.match('#123')[:issue]).to eq('123') + end + end end |