diff options
author | Robert Speicher <rspeicher@gmail.com> | 2015-04-29 21:28:24 +0300 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2015-04-30 23:35:27 +0300 |
commit | f4fac3ac878a32d60e9dcc8dbe3c3c1da9e4a78d (patch) | |
tree | 02cccb4ab147f07b9cf4cd2c6d3ea412848806d4 /spec | |
parent | 50f707e27ade6952b87aef86714f056dea2a1da3 (diff) |
Add jira_project project factory
Diffstat (limited to 'spec')
-rw-r--r-- | spec/factories/projects.rb | 20 | ||||
-rw-r--r-- | spec/lib/gitlab/markdown/external_issue_reference_filter_spec.rb | 19 |
2 files changed, 19 insertions, 20 deletions
diff --git a/spec/factories/projects.rb b/spec/factories/projects.rb index 57fa079d753..102678a1d74 100644 --- a/spec/factories/projects.rb +++ b/spec/factories/projects.rb @@ -94,10 +94,26 @@ FactoryGirl.define do 'new_issue_url' => 'http://redmine/projects/project_name_in_redmine/issues/new' } ) - end - after :create do |project| + project.issues_tracker = 'redmine' project.issues_tracker_id = 'project_name_in_redmine' end end + + factory :jira_project, parent: :project do + after :create do |project| + project.create_jira_service( + active: true, + properties: { + 'title' => 'JIRA tracker', + 'project_url' => 'http://jira.example/issues/?jql=project=A', + 'issues_url' => 'http://jira.example/browse/:id', + 'new_issue_url' => 'http://jira.example/secure/CreateIssue.jspa' + } + ) + + project.issues_tracker = 'jira' + project.issues_tracker_id = 'project_name_in_jira' + end + end end diff --git a/spec/lib/gitlab/markdown/external_issue_reference_filter_spec.rb b/spec/lib/gitlab/markdown/external_issue_reference_filter_spec.rb index 27e930ef7da..b19bc125b92 100644 --- a/spec/lib/gitlab/markdown/external_issue_reference_filter_spec.rb +++ b/spec/lib/gitlab/markdown/external_issue_reference_filter_spec.rb @@ -8,29 +8,12 @@ module Gitlab::Markdown IssuesHelper end - let(:project) { create(:empty_project) } + let(:project) { create(:jira_project) } let(:issue) { double('issue', iid: 123) } context 'JIRA issue references' do let(:reference) { "JIRA-#{issue.iid}" } - before do - jira = project.create_jira_service - - props = { - 'title' => 'JIRA tracker', - 'project_url' => 'http://jira.example/issues/?jql=project=A', - 'issues_url' => 'http://jira.example/browse/:id', - 'new_issue_url' => 'http://jira.example/secure/CreateIssue.jspa' - } - - jira.update_attributes(properties: props, active: true) - end - - after do - project.jira_service.destroy - end - it 'requires project context' do expect { described_class.call('Issue JIRA-123', {}) }. to raise_error(ArgumentError, /:project/) |