Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-09-16 18:06:26 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-09-16 18:06:26 +0300
commit84727c8209a4412e21111a07f99b0438b03232de (patch)
tree1fcfa02b01548c3cdc561186870a1c807f227f0b /spec/factories/services.rb
parentd2798d607e11e0ebae83ae909404834388733428 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/factories/services.rb')
-rw-r--r--spec/factories/services.rb74
1 files changed, 47 insertions, 27 deletions
diff --git a/spec/factories/services.rb b/spec/factories/services.rb
index b2d6ada91fa..c4cb3f07fe7 100644
--- a/spec/factories/services.rb
+++ b/spec/factories/services.rb
@@ -9,11 +9,7 @@ FactoryBot.define do
factory :custom_issue_tracker_service, class: CustomIssueTrackerService do
project
active true
- properties(
- project_url: 'https://project.url.com',
- issues_url: 'https://issues.url.com',
- new_issue_url: 'https://newissue.url.com'
- )
+ issue_tracker
end
factory :emails_on_push_service do
@@ -47,12 +43,24 @@ FactoryBot.define do
factory :jira_service do
project
active true
- properties(
- url: 'https://jira.example.com',
- username: 'jira_user',
- password: 'my-secret-password',
- project_key: 'jira-key'
- )
+
+ transient do
+ create_data true
+ url 'https://jira.example.com'
+ api_url nil
+ username 'jira_username'
+ password 'jira_password'
+ jira_issue_transition_id '56-1'
+ end
+
+ after(:build) do |service, evaluator|
+ if evaluator.create_data
+ create(:jira_tracker_data, service: service,
+ url: evaluator.url, api_url: evaluator.api_url, jira_issue_transition_id: evaluator.jira_issue_transition_id,
+ username: evaluator.username, password: evaluator.password
+ )
+ end
+ end
end
factory :bugzilla_service do
@@ -80,20 +88,26 @@ FactoryBot.define do
end
trait :issue_tracker do
- properties(
- project_url: 'http://issue-tracker.example.com',
- issues_url: 'http://issue-tracker.example.com/issues/:id',
- new_issue_url: 'http://issue-tracker.example.com'
- )
+ transient do
+ create_data true
+ project_url 'http://issuetracker.example.com'
+ issues_url 'http://issues.example.com/issues/:id'
+ new_issue_url 'http://new-issue.example.com'
+ end
+
+ after(:build) do |service, evaluator|
+ if evaluator.create_data
+ create(:issue_tracker_data, service: service,
+ project_url: evaluator.project_url, issues_url: evaluator.issues_url, new_issue_url: evaluator.new_issue_url
+ )
+ end
+ end
end
trait :jira_cloud_service do
- properties(
- url: 'https://mysite.atlassian.net',
- username: 'jira_user',
- password: 'my-secret-password',
- project_key: 'jira-key'
- )
+ url 'https://mysite.atlassian.net'
+ username 'jira_user'
+ password 'my-secret-password'
end
factory :hipchat_service do
@@ -102,15 +116,21 @@ FactoryBot.define do
token 'test_token'
end
+ # this is for testing storing values inside properties, which is deprecated and will be removed in
+ # https://gitlab.com/gitlab-org/gitlab-ce/issues/63084
trait :without_properties_callback do
+ jira_tracker_data nil
+ issue_tracker_data nil
+ create_data false
+
after(:build) do |service|
- allow(service).to receive(:handle_properties)
+ IssueTrackerService.skip_callback(:validation, :before, :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
+ to_create { |instance| instance.save(validate: false)}
+
+ after(:create) do
+ IssueTrackerService.set_callback(:validation, :before, :handle_properties)
end
end
end