From 85c87be361e804977e7924ea9e464d0752cd2f24 Mon Sep 17 00:00:00 2001 From: George Andrinopoulos Date: Tue, 21 Feb 2017 15:44:21 +0200 Subject: Add spec for todo with target_type Commit --- spec/factories/todos.rb | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'spec/factories') diff --git a/spec/factories/todos.rb b/spec/factories/todos.rb index b4e4cd97780..a2cedda0eec 100644 --- a/spec/factories/todos.rb +++ b/spec/factories/todos.rb @@ -44,4 +44,13 @@ FactoryGirl.define do state :done end end + + factory :on_commit_todo, class: Todo do + project factory: :empty_project + author + user + action { Todo::ASSIGNED } + commit_id RepoHelpers.sample_commit.id + target_type "Commit" + end end -- cgit v1.2.1 From d52ef5efd03423006717018d3c3b9d6ff11a378b Mon Sep 17 00:00:00 2001 From: Valery Sizov Date: Tue, 7 Feb 2017 17:59:38 +0200 Subject: Fixes after review --- spec/factories/services.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'spec/factories') diff --git a/spec/factories/services.rb b/spec/factories/services.rb index a14a46c803e..51335bdcf1d 100644 --- a/spec/factories/services.rb +++ b/spec/factories/services.rb @@ -2,4 +2,14 @@ FactoryGirl.define do factory :service do project factory: :empty_project end + + factory :kubernetes_service do + project factory: :empty_project + active true + properties({ + namespace: 'somepath', + api_url: 'https://kubernetes.example.com', + token: 'a' * 40, + }) + end end -- cgit v1.2.1 From 8e684809765fa866a125c176327825ebc565f5b3 Mon Sep 17 00:00:00 2001 From: Timothy Andrew Date: Mon, 6 Feb 2017 17:37:05 +0530 Subject: Use a `ghost` boolean to track ghost users. Rather than using a separate `ghost` state. This lets us have the benefits of both ghost and blocked users (ghost: true, state: blocked) without having to rewrite a number of queries to include cases for `state: ghost`. --- spec/factories/users.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'spec/factories') diff --git a/spec/factories/users.rb b/spec/factories/users.rb index 1732b1a0081..58602c54c7a 100644 --- a/spec/factories/users.rb +++ b/spec/factories/users.rb @@ -26,6 +26,10 @@ FactoryGirl.define do two_factor_via_otp end + trait :ghost do + ghost true + end + trait :two_factor_via_otp do before(:create) do |user| user.otp_required_for_login = true -- cgit v1.2.1 From 6fdb17cbbe5dc70d18f50e9d131ab70407976a71 Mon Sep 17 00:00:00 2001 From: Timothy Andrew Date: Fri, 17 Feb 2017 20:28:12 +0530 Subject: Don't allow deleting a ghost user. - Add a `destroy_user` ability. This didn't exist before, and was implicit in other abilities (only admins could access the admin area, so only they could destroy all users; a user can only access their own account page, and so can destroy only themselves). - Grant this ability to admins, and when the current user is trying to destroy themselves. Disallow destroying ghost users in all cases. - Modify the `Users::DestroyService` to check this ability. Also check it in views to decide whether or not to show the "Delete User" button. - Add a short summary of the Ghost User to the bio. --- spec/factories/users.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'spec/factories') diff --git a/spec/factories/users.rb b/spec/factories/users.rb index 58602c54c7a..249dabbaae8 100644 --- a/spec/factories/users.rb +++ b/spec/factories/users.rb @@ -28,6 +28,7 @@ FactoryGirl.define do trait :ghost do ghost true + after(:build) { |user, _| user.block! } end trait :two_factor_via_otp do -- cgit v1.2.1 From faa2e2df8fb95655ebfb8523689295e223005d9d Mon Sep 17 00:00:00 2001 From: Douwe Maan Date: Wed, 15 Feb 2017 17:28:29 -0600 Subject: Rename commit_file, commit_dir and remove_file and update specs --- spec/factories/projects.rb | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'spec/factories') diff --git a/spec/factories/projects.rb b/spec/factories/projects.rb index c80b09e9b9d..586efdefdb3 100644 --- a/spec/factories/projects.rb +++ b/spec/factories/projects.rb @@ -138,27 +138,24 @@ FactoryGirl.define do project.add_user(args[:user], args[:access]) - project.repository.commit_file( + project.repository.create_file( args[:user], ".gitlab/#{args[:path]}/bug.md", 'something valid', message: 'test 3', - branch_name: 'master', - update: false) - project.repository.commit_file( + branch_name: 'master') + project.repository.create_file( args[:user], ".gitlab/#{args[:path]}/template_test.md", 'template_test', message: 'test 1', - branch_name: 'master', - update: false) - project.repository.commit_file( + branch_name: 'master') + project.repository.create_file( args[:user], ".gitlab/#{args[:path]}/feature_proposal.md", 'feature_proposal', message: 'test 2', - branch_name: 'master', - update: false) + branch_name: 'master') end end end -- cgit v1.2.1 From 54c1dc675f4eba7083373149222cd6b7b9292d1b Mon Sep 17 00:00:00 2001 From: George Andrinopoulos Date: Tue, 28 Feb 2017 15:59:52 +0200 Subject: Remove on_commit trait from todos factory --- spec/factories/todos.rb | 5 ----- 1 file changed, 5 deletions(-) (limited to 'spec/factories') diff --git a/spec/factories/todos.rb b/spec/factories/todos.rb index a2cedda0eec..299d09d2181 100644 --- a/spec/factories/todos.rb +++ b/spec/factories/todos.rb @@ -18,11 +18,6 @@ FactoryGirl.define do action { Todo::DIRECTLY_ADDRESSED } end - trait :on_commit do - commit_id RepoHelpers.sample_commit.id - target_type "Commit" - end - trait :build_failed do action { Todo::BUILD_FAILED } target factory: :merge_request -- cgit v1.2.1 From 81246e5649a8fb9e73369cbd117505a546d7e807 Mon Sep 17 00:00:00 2001 From: Simon Vocella Date: Tue, 27 Dec 2016 17:26:57 +0100 Subject: manage personal_access_tokens through api --- spec/factories/personal_access_tokens.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'spec/factories') diff --git a/spec/factories/personal_access_tokens.rb b/spec/factories/personal_access_tokens.rb index 811eab7e15b..3464d2d5d89 100644 --- a/spec/factories/personal_access_tokens.rb +++ b/spec/factories/personal_access_tokens.rb @@ -6,5 +6,13 @@ FactoryGirl.define do revoked false expires_at { 5.days.from_now } scopes ['api'] + + factory :revoked_personal_access_token do + revoked true + end + + factory :expired_personal_access_token do + expires_at { 1.day.ago } + end end end -- cgit v1.2.1 From a3dfb58e7f1b1a3df4a4c16b2d09e50831370a69 Mon Sep 17 00:00:00 2001 From: Simon Vocella Date: Wed, 28 Dec 2016 17:19:08 +0100 Subject: add impersonation token --- spec/factories/personal_access_tokens.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'spec/factories') diff --git a/spec/factories/personal_access_tokens.rb b/spec/factories/personal_access_tokens.rb index 3464d2d5d89..1905b22935b 100644 --- a/spec/factories/personal_access_tokens.rb +++ b/spec/factories/personal_access_tokens.rb @@ -6,6 +6,7 @@ FactoryGirl.define do revoked false expires_at { 5.days.from_now } scopes ['api'] + impersonation false factory :revoked_personal_access_token do revoked true @@ -14,5 +15,9 @@ FactoryGirl.define do factory :expired_personal_access_token do expires_at { 1.day.ago } end + + factory :impersonation_personal_access_token do + impersonation true + end end end -- cgit v1.2.1 From dd9d8ce82e5957974f87401d6dd437e4d2f3ad38 Mon Sep 17 00:00:00 2001 From: Grzegorz Bizon Date: Wed, 1 Mar 2017 11:39:36 +0100 Subject: Fix runner tags assignment when retrying a job --- spec/factories/ci/builds.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'spec/factories') diff --git a/spec/factories/ci/builds.rb b/spec/factories/ci/builds.rb index a90534d10ba..8218293604d 100644 --- a/spec/factories/ci/builds.rb +++ b/spec/factories/ci/builds.rb @@ -76,6 +76,10 @@ FactoryGirl.define do manual end + trait :tags do + tag_list [:docker, :ruby] + end + after(:build) do |build, evaluator| build.project = build.pipeline.project end -- cgit v1.2.1 From 6f84345725ef11493653a888ed59fc6411825779 Mon Sep 17 00:00:00 2001 From: Grzegorz Bizon Date: Wed, 1 Mar 2017 11:57:06 +0100 Subject: Improve build retry service tests for cloning data --- spec/factories/ci/builds.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'spec/factories') diff --git a/spec/factories/ci/builds.rb b/spec/factories/ci/builds.rb index 8218293604d..cabe128acf7 100644 --- a/spec/factories/ci/builds.rb +++ b/spec/factories/ci/builds.rb @@ -80,6 +80,14 @@ FactoryGirl.define do tag_list [:docker, :ruby] end + trait :on_tag do + tag true + end + + trait :triggered do + trigger_request factory: :ci_trigger_request_with_variables + end + after(:build) do |build, evaluator| build.project = build.pipeline.project end -- cgit v1.2.1 From a0101ebf84ed397899df8f3a017d2b25dc45db57 Mon Sep 17 00:00:00 2001 From: James Lopez Date: Fri, 17 Feb 2017 14:56:13 +0100 Subject: Update occurrences of MWBS to MWPS Rename column in the database Rename fields related to import/export feature Rename API endpoints Rename documentation links Rename the rest of occurrences in the code Replace the images that contain the words "build succeeds" and docs referencing to them Make sure pipeline is green and nothing is missing. updated doc images renamed only_allow_merge_if_build_succeeds in projects and fixed references more updates fix some spec failures fix rubocop offences fix v3 api spec fix MR specs fixed issues with partials fix MR spec fix alignment add missing v3 to v4 doc wip - refactor v3 endpoints fix specs fix a few typos fix project specs copy entities fully to V3 fix entity error more fixes fix failing specs fixed missing entities in V3 API remove comment updated code based on feedback typo fix spec --- spec/factories/merge_requests.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'spec/factories') diff --git a/spec/factories/merge_requests.rb b/spec/factories/merge_requests.rb index 22f84150bb3..ae0bbbd6aeb 100644 --- a/spec/factories/merge_requests.rb +++ b/spec/factories/merge_requests.rb @@ -59,8 +59,8 @@ FactoryGirl.define do target_branch "master" end - trait :merge_when_build_succeeds do - merge_when_build_succeeds true + trait :merge_when_pipeline_succeeds do + merge_when_pipeline_succeeds true merge_user author end -- cgit v1.2.1 From 3eafffcef0f8932bab4e06b465f9b63327e87942 Mon Sep 17 00:00:00 2001 From: Tomasz Maczukin Date: Thu, 16 Feb 2017 01:05:44 +0100 Subject: Refactor JobRequest response structure --- spec/factories/ci/builds.rb | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) (limited to 'spec/factories') diff --git a/spec/factories/ci/builds.rb b/spec/factories/ci/builds.rb index a90534d10ba..a77b3356b9a 100644 --- a/spec/factories/ci/builds.rb +++ b/spec/factories/ci/builds.rb @@ -15,8 +15,8 @@ FactoryGirl.define do options do { - image: "ruby:2.1", - services: ["postgres"] + image: 'ruby:2.1', + services: ['postgres'] } end @@ -151,5 +151,27 @@ FactoryGirl.define do allow(build).to receive(:commit).and_return build(:commit) end end + + trait :extended_options do + options do + { + image: 'ruby:2.1', + services: ['postgres'], + after_script: "ls\ndate", + artifacts: { + name: 'artifacts_file', + untracked: false, + paths: ['out/'], + when: 'always', + expire_in: '7d' + }, + cache: { + key: 'cache_key', + untracked: false, + paths: ['vendor/*'] + } + } + end + end end end -- cgit v1.2.1 From 5c1aa5fb65ec7474956e6972e40b04b3a967c338 Mon Sep 17 00:00:00 2001 From: Tomasz Maczukin Date: Thu, 2 Mar 2017 17:44:15 +0100 Subject: Add some fixes and refactoring after review --- spec/factories/ci/builds.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'spec/factories') diff --git a/spec/factories/ci/builds.rb b/spec/factories/ci/builds.rb index a77b3356b9a..8ba370c36ea 100644 --- a/spec/factories/ci/builds.rb +++ b/spec/factories/ci/builds.rb @@ -173,5 +173,9 @@ FactoryGirl.define do } end end + + trait :no_options do + options { {} } + end end end -- cgit v1.2.1 From e26b4f0c1e2a35331bb9ec83fdb36829f2210ba9 Mon Sep 17 00:00:00 2001 From: Douwe Maan Date: Thu, 2 Mar 2017 12:55:30 -0600 Subject: Delete hooks from project with empty repository --- spec/factories/projects.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'spec/factories') diff --git a/spec/factories/projects.rb b/spec/factories/projects.rb index 586efdefdb3..04de3512125 100644 --- a/spec/factories/projects.rb +++ b/spec/factories/projects.rb @@ -39,6 +39,10 @@ FactoryGirl.define do trait :empty_repo do after(:create) do |project| project.create_repository + + # We delete hooks so that gitlab-shell will not try to authenticate with + # an API that isn't running + FileUtils.rm_r(File.join(project.repository_storage_path, "#{project.path_with_namespace}.git", 'hooks')) end end -- cgit v1.2.1 From 79ea01bfaffa743e98716cf9f9f811c6843dea4b Mon Sep 17 00:00:00 2001 From: Grzegorz Bizon Date: Thu, 2 Mar 2017 13:45:01 +0100 Subject: Refactor code related to pipeline blocking actions --- spec/factories/ci/builds.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'spec/factories') diff --git a/spec/factories/ci/builds.rb b/spec/factories/ci/builds.rb index cabe128acf7..52244888e13 100644 --- a/spec/factories/ci/builds.rb +++ b/spec/factories/ci/builds.rb @@ -71,6 +71,10 @@ FactoryGirl.define do allow_failure true end + trait :ignored do + allowed_to_fail + end + trait :playable do skipped manual -- cgit v1.2.1 From 17faa8a2bf6843391ca6b834f889de74b9ce4c56 Mon Sep 17 00:00:00 2001 From: Grzegorz Bizon Date: Sat, 4 Mar 2017 10:06:09 +0100 Subject: Fix specs for environments with manual actions --- spec/factories/ci/builds.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spec/factories') diff --git a/spec/factories/ci/builds.rb b/spec/factories/ci/builds.rb index 52244888e13..5a7555e9230 100644 --- a/spec/factories/ci/builds.rb +++ b/spec/factories/ci/builds.rb @@ -57,7 +57,7 @@ FactoryGirl.define do end trait :manual do - status 'skipped' + status 'manual' self.when 'manual' end -- cgit v1.2.1 From 57253f04c931fa15c3b6aaacd51e971f78425ccb Mon Sep 17 00:00:00 2001 From: Grzegorz Bizon Date: Sat, 4 Mar 2017 10:18:25 +0100 Subject: Fix specs for detailed statuses for manual actions --- spec/factories/ci/builds.rb | 1 - 1 file changed, 1 deletion(-) (limited to 'spec/factories') diff --git a/spec/factories/ci/builds.rb b/spec/factories/ci/builds.rb index 5a7555e9230..279583c2c44 100644 --- a/spec/factories/ci/builds.rb +++ b/spec/factories/ci/builds.rb @@ -76,7 +76,6 @@ FactoryGirl.define do end trait :playable do - skipped manual end -- cgit v1.2.1 From cb4c9a03ce0035c1f56f56579e45447fa6bc96ee Mon Sep 17 00:00:00 2001 From: Grzegorz Bizon Date: Mon, 6 Mar 2017 13:54:29 +0100 Subject: Extend specs for code we use to calculate statuses --- spec/factories/commit_statuses.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'spec/factories') diff --git a/spec/factories/commit_statuses.rb b/spec/factories/commit_statuses.rb index 756b341ecba..169590deb8e 100644 --- a/spec/factories/commit_statuses.rb +++ b/spec/factories/commit_statuses.rb @@ -35,6 +35,10 @@ FactoryGirl.define do status 'created' end + trait :manual do + status 'manual' + end + after(:build) do |build, evaluator| build.project = build.pipeline.project end -- cgit v1.2.1 From 9f612cc428c47a578bef8869e2e93966c021e655 Mon Sep 17 00:00:00 2001 From: Sean McGivern Date: Fri, 3 Mar 2017 14:25:52 +0000 Subject: Fix issues mentioned but not closed for JIRA The `ReferenceExtractor` would return an array of `ExternalIssue` objects, and then perform `Array#-` to remove the issues closed. `ExternalIssue`s had `==` defined, but not `hash` or `eql?`, which are used by `Array#-`. --- spec/factories/services.rb | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'spec/factories') diff --git a/spec/factories/services.rb b/spec/factories/services.rb index 51335bdcf1d..88f6c265505 100644 --- a/spec/factories/services.rb +++ b/spec/factories/services.rb @@ -12,4 +12,13 @@ FactoryGirl.define do token: 'a' * 40, }) end + + factory :jira_service do + project factory: :empty_project + active true + properties( + url: 'https://jira.example.com', + project_key: 'jira-key' + ) + end end -- cgit v1.2.1 From 5ce3845f17c2c6e168cf2bd1b3c5093f10db1953 Mon Sep 17 00:00:00 2001 From: Sean McGivern Date: Mon, 6 Mar 2017 14:18:59 +0000 Subject: DRY up {jira,kubernets}_project factories --- spec/factories/projects.rb | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) (limited to 'spec/factories') diff --git a/spec/factories/projects.rb b/spec/factories/projects.rb index 04de3512125..70c65bc693a 100644 --- a/spec/factories/projects.rb +++ b/spec/factories/projects.rb @@ -189,29 +189,10 @@ FactoryGirl.define do factory :jira_project, parent: :project do has_external_issue_tracker true - - after :create do |project| - project.create_jira_service( - active: true, - properties: { - title: 'JIRA tracker', - url: 'http://jira.example.net', - project_key: 'JIRA' - } - ) - end + jira_service end factory :kubernetes_project, parent: :empty_project do - after :create do |project| - project.create_kubernetes_service( - active: true, - properties: { - namespace: project.path, - api_url: 'https://kubernetes.example.com', - token: 'a' * 40, - } - ) - end + kubernetes_service end end -- cgit v1.2.1 From 005749a616c19b90d6ec0415df9ae5e35151e33c Mon Sep 17 00:00:00 2001 From: Tiago Botelho Date: Wed, 1 Mar 2017 16:59:03 +0000 Subject: apply codestyle and implementation changes to the respective feature code --- spec/factories/personal_access_tokens.rb | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'spec/factories') diff --git a/spec/factories/personal_access_tokens.rb b/spec/factories/personal_access_tokens.rb index 1905b22935b..7b15ba47de1 100644 --- a/spec/factories/personal_access_tokens.rb +++ b/spec/factories/personal_access_tokens.rb @@ -8,16 +8,20 @@ FactoryGirl.define do scopes ['api'] impersonation false - factory :revoked_personal_access_token do + trait :impersonation do + impersonation true + end + + trait :revoked do revoked true end - factory :expired_personal_access_token do + trait :expired do expires_at { 1.day.ago } end - factory :impersonation_personal_access_token do - impersonation true + trait :invalid do + token nil end end end -- cgit v1.2.1 From c4982890489d254da2fe998aab30bf257767ed5e Mon Sep 17 00:00:00 2001 From: Markus Koller Date: Fri, 9 Dec 2016 18:36:50 +0100 Subject: Implement OpenID Connect identity provider --- spec/factories/oauth_access_grants.rb | 11 +++++++++++ spec/factories/oauth_access_tokens.rb | 3 ++- spec/factories/oauth_applications.rb | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 spec/factories/oauth_access_grants.rb (limited to 'spec/factories') diff --git a/spec/factories/oauth_access_grants.rb b/spec/factories/oauth_access_grants.rb new file mode 100644 index 00000000000..543b3e99274 --- /dev/null +++ b/spec/factories/oauth_access_grants.rb @@ -0,0 +1,11 @@ +FactoryGirl.define do + factory :oauth_access_grant do + resource_owner_id { create(:user).id } + application + token { Doorkeeper::OAuth::Helpers::UniqueToken.generate } + expires_in 2.hours + + redirect_uri { application.redirect_uri } + scopes { application.scopes } + end +end diff --git a/spec/factories/oauth_access_tokens.rb b/spec/factories/oauth_access_tokens.rb index ccf02d0719b..a46bc1d8ce8 100644 --- a/spec/factories/oauth_access_tokens.rb +++ b/spec/factories/oauth_access_tokens.rb @@ -2,6 +2,7 @@ FactoryGirl.define do factory :oauth_access_token do resource_owner application - token '123456' + token { Doorkeeper::OAuth::Helpers::UniqueToken.generate } + scopes { application.scopes } end end diff --git a/spec/factories/oauth_applications.rb b/spec/factories/oauth_applications.rb index d116a573830..86cdc208268 100644 --- a/spec/factories/oauth_applications.rb +++ b/spec/factories/oauth_applications.rb @@ -1,7 +1,7 @@ FactoryGirl.define do factory :oauth_application, class: 'Doorkeeper::Application', aliases: [:application] do name { FFaker::Name.name } - uid { FFaker::Name.name } + uid { Doorkeeper::OAuth::Helpers::UniqueToken.generate } redirect_uri { FFaker::Internet.uri('http') } owner owner_type 'User' -- cgit v1.2.1 From 7fb2d94e56e2e74ec00a5c221d9aaa494222a573 Mon Sep 17 00:00:00 2001 From: "Z.J. van de Weg" Date: Tue, 7 Mar 2017 15:20:22 +0100 Subject: Namespace can have only one chat team --- spec/factories/chat_teams.rb | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 spec/factories/chat_teams.rb (limited to 'spec/factories') diff --git a/spec/factories/chat_teams.rb b/spec/factories/chat_teams.rb new file mode 100644 index 00000000000..82f44fa3d15 --- /dev/null +++ b/spec/factories/chat_teams.rb @@ -0,0 +1,9 @@ +FactoryGirl.define do + factory :chat_team, class: ChatTeam do + sequence :team_id do |n| + "abcdefghijklm#{n}" + end + + namespace factory: :group + end +end -- cgit v1.2.1 From 55f2a5debcf10a4d3ca1d0e53fe06f38bc0b77a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20Trzci=C5=84ski?= Date: Tue, 7 Mar 2017 16:57:42 +0000 Subject: Added Prometheus Service and Prometheus graphs --- spec/factories/projects.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'spec/factories') diff --git a/spec/factories/projects.rb b/spec/factories/projects.rb index 70c65bc693a..c6f91e05d83 100644 --- a/spec/factories/projects.rb +++ b/spec/factories/projects.rb @@ -195,4 +195,15 @@ FactoryGirl.define do factory :kubernetes_project, parent: :empty_project do kubernetes_service end + + factory :prometheus_project, parent: :empty_project do + after :create do |project| + project.create_prometheus_service( + active: true, + properties: { + api_url: 'https://prometheus.example.com' + } + ) + end + end end -- cgit v1.2.1 From 82327ea7c68faf4bb3231c0418f277fde876ec59 Mon Sep 17 00:00:00 2001 From: Grzegorz Bizon Date: Wed, 8 Mar 2017 11:44:36 +0100 Subject: Add specs for an extended blocked pipeline status --- spec/factories/ci/pipelines.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'spec/factories') diff --git a/spec/factories/ci/pipelines.rb b/spec/factories/ci/pipelines.rb index 77404f46c92..b67c96bc00d 100644 --- a/spec/factories/ci/pipelines.rb +++ b/spec/factories/ci/pipelines.rb @@ -40,6 +40,14 @@ FactoryGirl.define do trait :invalid do config(rspec: nil) end + + trait :blocked do + status :manual + end + + trait :success do + status :success + end end end end -- cgit v1.2.1 From 4b1dd072c63e71f19f173c0f4f0c87e5e3cf0f13 Mon Sep 17 00:00:00 2001 From: Nick Thomas Date: Wed, 8 Mar 2017 17:04:44 +0000 Subject: Raise an exception if creating a test repository fails --- spec/factories/projects.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'spec/factories') diff --git a/spec/factories/projects.rb b/spec/factories/projects.rb index c6f91e05d83..0db2fe04edd 100644 --- a/spec/factories/projects.rb +++ b/spec/factories/projects.rb @@ -38,7 +38,7 @@ FactoryGirl.define do trait :empty_repo do after(:create) do |project| - project.create_repository + raise "Failed to create repository!" unless project.create_repository # We delete hooks so that gitlab-shell will not try to authenticate with # an API that isn't running @@ -48,7 +48,7 @@ FactoryGirl.define do trait :broken_repo do after(:create) do |project| - project.create_repository + raise "Failed to create repository!" unless project.create_repository FileUtils.rm_r(File.join(project.repository_storage_path, "#{project.path_with_namespace}.git", 'refs')) end -- cgit v1.2.1 From 0267b83898d604181e70c5ea8ac4a84108d2e6d6 Mon Sep 17 00:00:00 2001 From: Bob Van Landuyt Date: Thu, 22 Dec 2016 13:31:12 +0100 Subject: Delegate a single discussion to a new issue Delegate a discussion in a merge request into a new issue. The discussion wil be marked as resolved and a system note will be added linking to the newly created issue. --- spec/factories/notes.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'spec/factories') diff --git a/spec/factories/notes.rb b/spec/factories/notes.rb index 5c50cd7f4ad..fe19a404e16 100644 --- a/spec/factories/notes.rb +++ b/spec/factories/notes.rb @@ -26,12 +26,17 @@ FactoryGirl.define do factory :diff_note_on_merge_request, traits: [:on_merge_request], class: DiffNote do association :project, :repository + + transient do + line_number 14 + end + position do Gitlab::Diff::Position.new( old_path: "files/ruby/popen.rb", new_path: "files/ruby/popen.rb", old_line: nil, - new_line: 14, + new_line: line_number, diff_refs: noteable.diff_refs ) end -- cgit v1.2.1 From 12dd5ac22110bc3327297232d96f2afebaefc5eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20Trzci=C5=84ski?= Date: Fri, 17 Mar 2017 23:06:11 +0000 Subject: All CI offline migrations --- spec/factories/ci/runner_projects.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spec/factories') diff --git a/spec/factories/ci/runner_projects.rb b/spec/factories/ci/runner_projects.rb index 3372e5ab685..6712dd5d82e 100644 --- a/spec/factories/ci/runner_projects.rb +++ b/spec/factories/ci/runner_projects.rb @@ -1,6 +1,6 @@ FactoryGirl.define do factory :ci_runner_project, class: Ci::RunnerProject do runner_id 1 - gl_project_id 1 + project_id 1 end end -- cgit v1.2.1 From bf41a2e7525cc952686623b508023c169dbdfe2d Mon Sep 17 00:00:00 2001 From: Jarka Kadlecova Date: Mon, 20 Mar 2017 09:20:46 +0100 Subject: Todos performance: Include associations in Finder --- spec/factories/merge_requests.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'spec/factories') diff --git a/spec/factories/merge_requests.rb b/spec/factories/merge_requests.rb index ae0bbbd6aeb..21487541507 100644 --- a/spec/factories/merge_requests.rb +++ b/spec/factories/merge_requests.rb @@ -4,6 +4,7 @@ FactoryGirl.define do author association :source_project, :repository, factory: :project target_project { source_project } + project { target_project } # $ git log --pretty=oneline feature..master # 5937ac0a7beb003549fc5fd26fc247adbce4a52e Add submodule from gitlab.com -- cgit v1.2.1