2019-07-25 01:11:48 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-12-13 19:13:44 -05:00
|
|
|
FactoryBot.define do
|
2016-02-16 22:55:24 -05:00
|
|
|
factory :service do
|
2017-08-02 15:55:11 -04:00
|
|
|
project
|
2017-04-25 11:48:12 -04:00
|
|
|
type 'Service'
|
|
|
|
end
|
|
|
|
|
|
|
|
factory :custom_issue_tracker_service, class: CustomIssueTrackerService do
|
2017-08-02 15:55:11 -04:00
|
|
|
project
|
2017-04-25 11:48:12 -04:00
|
|
|
active true
|
|
|
|
properties(
|
|
|
|
project_url: 'https://project.url.com',
|
|
|
|
issues_url: 'https://issues.url.com',
|
|
|
|
new_issue_url: 'https://newissue.url.com'
|
|
|
|
)
|
2016-02-16 22:55:24 -05:00
|
|
|
end
|
2017-02-07 10:59:38 -05:00
|
|
|
|
2019-08-15 13:37:36 -04:00
|
|
|
factory :emails_on_push_service do
|
|
|
|
project
|
|
|
|
type 'EmailsOnPushService'
|
|
|
|
active true
|
|
|
|
push_events true
|
|
|
|
tag_push_events true
|
|
|
|
properties(
|
|
|
|
recipients: 'test@example.com',
|
|
|
|
disable_diffs: true,
|
|
|
|
send_from_committer_email: true
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
2019-02-06 22:00:32 -05:00
|
|
|
factory :mock_deployment_service do
|
|
|
|
project
|
|
|
|
type 'MockDeploymentService'
|
|
|
|
active true
|
|
|
|
end
|
|
|
|
|
2017-05-31 07:40:03 -04:00
|
|
|
factory :prometheus_service do
|
2017-08-02 15:55:11 -04:00
|
|
|
project
|
2017-05-31 07:40:03 -04:00
|
|
|
active true
|
|
|
|
properties({
|
2018-02-06 19:53:18 -05:00
|
|
|
api_url: 'https://prometheus.example.com/',
|
|
|
|
manual_configuration: true
|
2017-05-31 07:40:03 -04:00
|
|
|
})
|
|
|
|
end
|
|
|
|
|
2017-03-03 09:25:52 -05:00
|
|
|
factory :jira_service do
|
2017-08-02 15:55:11 -04:00
|
|
|
project
|
2017-03-03 09:25:52 -05:00
|
|
|
active true
|
|
|
|
properties(
|
|
|
|
url: 'https://jira.example.com',
|
2017-10-24 05:17:41 -04:00
|
|
|
username: 'jira_user',
|
|
|
|
password: 'my-secret-password',
|
2017-03-03 09:25:52 -05:00
|
|
|
project_key: 'jira-key'
|
|
|
|
)
|
|
|
|
end
|
2017-05-22 06:07:12 -04:00
|
|
|
|
2019-06-26 10:03:57 -04:00
|
|
|
factory :bugzilla_service do
|
|
|
|
project
|
|
|
|
active true
|
|
|
|
issue_tracker
|
|
|
|
end
|
|
|
|
|
|
|
|
factory :redmine_service do
|
|
|
|
project
|
|
|
|
active true
|
|
|
|
issue_tracker
|
|
|
|
end
|
|
|
|
|
|
|
|
factory :youtrack_service do
|
|
|
|
project
|
|
|
|
active true
|
|
|
|
issue_tracker
|
|
|
|
end
|
|
|
|
|
|
|
|
factory :gitlab_issue_tracker_service do
|
|
|
|
project
|
|
|
|
active true
|
|
|
|
issue_tracker
|
|
|
|
end
|
|
|
|
|
|
|
|
trait :issue_tracker do
|
|
|
|
properties(
|
|
|
|
project_url: 'http://issue-tracker.example.com',
|
2019-07-11 05:53:08 -04:00
|
|
|
issues_url: 'http://issue-tracker.example.com/issues/:id',
|
2019-06-26 10:03:57 -04:00
|
|
|
new_issue_url: 'http://issue-tracker.example.com'
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
2019-07-11 05:53:08 -04:00
|
|
|
trait :jira_cloud_service do
|
2018-11-03 20:37:47 -04:00
|
|
|
properties(
|
|
|
|
url: 'https://mysite.atlassian.net',
|
|
|
|
username: 'jira_user',
|
|
|
|
password: 'my-secret-password',
|
|
|
|
project_key: 'jira-key'
|
|
|
|
)
|
|
|
|
end
|
2019-04-09 09:06:36 -04:00
|
|
|
|
|
|
|
factory :hipchat_service do
|
|
|
|
project
|
|
|
|
type 'HipchatService'
|
|
|
|
token 'test_token'
|
|
|
|
end
|
2019-07-04 13:09:58 -04:00
|
|
|
|
|
|
|
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
|
2016-02-16 22:55:24 -05:00
|
|
|
end
|