Commit 46ec439c authored by Thong Kuah's avatar Thong Kuah

Merge branch 'fix-issue-trackers-spec' into 'master'

Make sure all specs run properly

See merge request gitlab-org/gitlab-ce!30367
parents 7db78736 e276f44b
...@@ -100,4 +100,16 @@ FactoryBot.define do ...@@ -100,4 +100,16 @@ FactoryBot.define do
type 'HipchatService' type 'HipchatService'
token 'test_token' token 'test_token'
end end
trait :without_properties_callback do
after(:build) do |service|
allow(service).to receive(:handle_properties)
end
after(:create) do |service|
# we have to remove the stub because the behaviour of
# handle_properties method is tested after the creation
allow(service).to receive(:handle_properties).and_call_original
end
end
end end
...@@ -44,7 +44,9 @@ describe BugzillaService do ...@@ -44,7 +44,9 @@ describe BugzillaService do
# this will be removed as part of https://gitlab.com/gitlab-org/gitlab-ce/issues/63084 # this will be removed as part of https://gitlab.com/gitlab-org/gitlab-ce/issues/63084
context 'when data are stored in properties' do context 'when data are stored in properties' do
let(:properties) { access_params.merge(title: title, description: description) } let(:properties) { access_params.merge(title: title, description: description) }
let(:service) { create(:bugzilla_service, properties: properties) } let(:service) do
create(:bugzilla_service, :without_properties_callback, properties: properties)
end
include_examples 'issue tracker fields' include_examples 'issue tracker fields'
end end
...@@ -60,7 +62,7 @@ describe BugzillaService do ...@@ -60,7 +62,7 @@ describe BugzillaService do
context 'when data are stored in both properties and separated fields' do context 'when data are stored in both properties and separated fields' do
let(:properties) { access_params.merge(title: 'wrong title', description: 'wrong description') } let(:properties) { access_params.merge(title: 'wrong title', description: 'wrong description') }
let(:service) do let(:service) do
create(:bugzilla_service, title: title, description: description, properties: properties) create(:bugzilla_service, :without_properties_callback, title: title, description: description, properties: properties)
end end
include_examples 'issue tracker fields' include_examples 'issue tracker fields'
......
...@@ -58,7 +58,9 @@ describe CustomIssueTrackerService do ...@@ -58,7 +58,9 @@ describe CustomIssueTrackerService do
# this will be removed as part of https://gitlab.com/gitlab-org/gitlab-ce/issues/63084 # this will be removed as part of https://gitlab.com/gitlab-org/gitlab-ce/issues/63084
context 'when data are stored in properties' do context 'when data are stored in properties' do
let(:properties) { access_params.merge(title: title, description: description) } let(:properties) { access_params.merge(title: title, description: description) }
let(:service) { create(:custom_issue_tracker_service, properties: properties) } let(:service) do
create(:custom_issue_tracker_service, :without_properties_callback, properties: properties)
end
include_examples 'issue tracker fields' include_examples 'issue tracker fields'
end end
...@@ -74,7 +76,7 @@ describe CustomIssueTrackerService do ...@@ -74,7 +76,7 @@ describe CustomIssueTrackerService do
context 'when data are stored in both properties and separated fields' do context 'when data are stored in both properties and separated fields' do
let(:properties) { access_params.merge(title: 'wrong title', description: 'wrong description') } let(:properties) { access_params.merge(title: 'wrong title', description: 'wrong description') }
let(:service) do let(:service) do
create(:custom_issue_tracker_service, title: title, description: description, properties: properties) create(:custom_issue_tracker_service, :without_properties_callback, title: title, description: description, properties: properties)
end end
include_examples 'issue tracker fields' include_examples 'issue tracker fields'
......
...@@ -61,7 +61,9 @@ describe GitlabIssueTrackerService do ...@@ -61,7 +61,9 @@ describe GitlabIssueTrackerService do
# this will be removed as part of https://gitlab.com/gitlab-org/gitlab-ce/issues/63084 # this will be removed as part of https://gitlab.com/gitlab-org/gitlab-ce/issues/63084
context 'when data are stored in properties' do context 'when data are stored in properties' do
let(:properties) { access_params.merge(title: title, description: description) } let(:properties) { access_params.merge(title: title, description: description) }
let(:service) { create(:gitlab_issue_tracker_service, properties: properties) } let(:service) do
create(:gitlab_issue_tracker_service, :without_properties_callback, properties: properties)
end
include_examples 'issue tracker fields' include_examples 'issue tracker fields'
end end
...@@ -77,7 +79,7 @@ describe GitlabIssueTrackerService do ...@@ -77,7 +79,7 @@ describe GitlabIssueTrackerService do
context 'when data are stored in both properties and separated fields' do context 'when data are stored in both properties and separated fields' do
let(:properties) { access_params.merge(title: 'wrong title', description: 'wrong description') } let(:properties) { access_params.merge(title: 'wrong title', description: 'wrong description') }
let(:service) do let(:service) do
create(:gitlab_issue_tracker_service, title: title, description: description, properties: properties) create(:gitlab_issue_tracker_service, :without_properties_callback, title: title, description: description, properties: properties)
end end
include_examples 'issue tracker fields' include_examples 'issue tracker fields'
......
...@@ -145,7 +145,9 @@ describe JiraService do ...@@ -145,7 +145,9 @@ describe JiraService do
# this will be removed as part of https://gitlab.com/gitlab-org/gitlab-ce/issues/63084 # this will be removed as part of https://gitlab.com/gitlab-org/gitlab-ce/issues/63084
context 'when data are stored in properties' do context 'when data are stored in properties' do
let(:properties) { access_params.merge(title: title, description: description) } let(:properties) { access_params.merge(title: title, description: description) }
let(:service) { create(:jira_service, properties: properties) } let(:service) do
create(:jira_service, :without_properties_callback, properties: properties)
end
include_examples 'issue tracker fields' include_examples 'issue tracker fields'
end end
...@@ -161,7 +163,7 @@ describe JiraService do ...@@ -161,7 +163,7 @@ describe JiraService do
context 'when data are stored in both properties and separated fields' do context 'when data are stored in both properties and separated fields' do
let(:properties) { access_params.merge(title: 'wrong title', description: 'wrong description') } let(:properties) { access_params.merge(title: 'wrong title', description: 'wrong description') }
let(:service) do let(:service) do
create(:jira_service, title: title, description: description, properties: properties) create(:jira_service, :without_properties_callback, title: title, description: description, properties: properties)
end end
include_examples 'issue tracker fields' include_examples 'issue tracker fields'
......
...@@ -50,7 +50,9 @@ describe RedmineService do ...@@ -50,7 +50,9 @@ describe RedmineService do
# this will be removed as part of https://gitlab.com/gitlab-org/gitlab-ce/issues/63084 # this will be removed as part of https://gitlab.com/gitlab-org/gitlab-ce/issues/63084
context 'when data are stored in properties' do context 'when data are stored in properties' do
let(:properties) { access_params.merge(title: title, description: description) } let(:properties) { access_params.merge(title: title, description: description) }
let(:service) { create(:redmine_service, properties: properties) } let(:service) do
create(:redmine_service, :without_properties_callback, properties: properties)
end
include_examples 'issue tracker fields' include_examples 'issue tracker fields'
end end
...@@ -66,7 +68,7 @@ describe RedmineService do ...@@ -66,7 +68,7 @@ describe RedmineService do
context 'when data are stored in both properties and separated fields' do context 'when data are stored in both properties and separated fields' do
let(:properties) { access_params.merge(title: 'wrong title', description: 'wrong description') } let(:properties) { access_params.merge(title: 'wrong title', description: 'wrong description') }
let(:service) do let(:service) do
create(:redmine_service, title: title, description: description, properties: properties) create(:redmine_service, :without_properties_callback, title: title, description: description, properties: properties)
end end
include_examples 'issue tracker fields' include_examples 'issue tracker fields'
......
...@@ -47,7 +47,9 @@ describe YoutrackService do ...@@ -47,7 +47,9 @@ describe YoutrackService do
# this will be removed as part of https://gitlab.com/gitlab-org/gitlab-ce/issues/63084 # this will be removed as part of https://gitlab.com/gitlab-org/gitlab-ce/issues/63084
context 'when data are stored in properties' do context 'when data are stored in properties' do
let(:properties) { access_params.merge(title: title, description: description) } let(:properties) { access_params.merge(title: title, description: description) }
let(:service) { create(:youtrack_service, properties: properties) } let(:service) do
create(:youtrack_service, :without_properties_callback, properties: properties)
end
include_examples 'issue tracker fields' include_examples 'issue tracker fields'
end end
...@@ -63,7 +65,7 @@ describe YoutrackService do ...@@ -63,7 +65,7 @@ describe YoutrackService do
context 'when data are stored in both properties and separated fields' do context 'when data are stored in both properties and separated fields' do
let(:properties) { access_params.merge(title: 'wrong title', description: 'wrong description') } let(:properties) { access_params.merge(title: 'wrong title', description: 'wrong description') }
let(:service) do let(:service) do
create(:youtrack_service, title: title, description: description, properties: properties) create(:youtrack_service, :without_properties_callback, title: title, description: description, properties: properties)
end end
include_examples 'issue tracker fields' include_examples 'issue tracker fields'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment