Commit 587794b4 authored by GitLab Bot's avatar GitLab Bot

Add latest changes from gitlab-org/gitlab@master

parent e0bd3a45
......@@ -355,7 +355,7 @@ group :development, :test do
gem 'fuubar', '~> 2.2.0'
gem 'database_cleaner', '~> 1.7.0'
gem 'factory_bot_rails', '~> 4.8.2'
gem 'factory_bot_rails', '~> 5.1.0'
gem 'rspec-rails', '~> 3.8.0'
gem 'rspec-retry', '~> 0.6.1'
gem 'rspec_profiling', '~> 0.0.5'
......
......@@ -254,7 +254,7 @@ GEM
mail (~> 2.7)
encryptor (3.0.0)
equalizer (0.0.11)
erubi (1.8.0)
erubi (1.9.0)
escape_utils (1.2.1)
et-orbi (1.2.1)
tzinfo
......@@ -264,11 +264,11 @@ GEM
expression_parser (0.9.0)
extended-markdown-filter (0.6.0)
html-pipeline (~> 2.0)
factory_bot (4.8.2)
activesupport (>= 3.0.0)
factory_bot_rails (4.8.2)
factory_bot (~> 4.8.2)
railties (>= 3.0.0)
factory_bot (5.1.0)
activesupport (>= 4.2.0)
factory_bot_rails (5.1.0)
factory_bot (~> 5.1.0)
railties (>= 4.2.0)
faraday (0.12.2)
multipart-post (>= 1.2, < 3)
faraday-http-cache (2.0.0)
......@@ -565,7 +565,7 @@ GEM
activesupport (>= 4)
railties (>= 4)
request_store (~> 1.0)
loofah (2.2.3)
loofah (2.3.0)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
mail (2.7.1)
......@@ -783,7 +783,7 @@ GEM
thor (>= 0.19.0, < 2.0)
rainbow (3.0.0)
raindrops (0.19.0)
rake (12.3.2)
rake (12.3.3)
rb-fsevent (0.10.2)
rb-inotify (0.9.10)
ffi (>= 0.5.0, < 2)
......@@ -1144,7 +1144,7 @@ DEPENDENCIES
email_reply_trimmer (~> 0.1)
email_spec (~> 2.2.0)
escape_utils (~> 1.1)
factory_bot_rails (~> 4.8.2)
factory_bot_rails (~> 5.1.0)
faraday (~> 0.12)
faraday_middleware-aws-signers-v4
fast_blank
......
......@@ -40,13 +40,17 @@ const createFlashEl = (message, type) => `
<div class="flash-content flash-${type} rounded">
<div class="flash-text">
${_.escape(message)}
${spriteIcon('close', 'close-icon')}
<div class="close-icon-wrapper js-close-icon">
${spriteIcon('close', 'close-icon')}
</div>
</div>
</div>
`;
const removeFlashClickListener = (flashEl, fadeTransition) => {
flashEl.addEventListener('click', () => hideFlash(flashEl, fadeTransition));
flashEl
.querySelector('.js-close-icon')
.addEventListener('click', () => hideFlash(flashEl, fadeTransition));
};
/*
......@@ -78,7 +82,6 @@ const createFlash = function createFlash(
flashContainer.innerHTML = createFlashEl(message, type);
const flashEl = flashContainer.querySelector(`.flash-${type}`);
removeFlashClickListener(flashEl, fadeTransition);
if (actionConfig) {
flashEl.innerHTML += createAction(actionConfig);
......@@ -90,6 +93,8 @@ const createFlash = function createFlash(
}
}
removeFlashClickListener(flashEl, fadeTransition);
flashContainer.style.display = 'block';
if (addBodyClass) document.body.classList.add('flash-shown');
......
$notification-box-shadow-color: rgba(0, 0, 0, 0.25);
.flash-container {
cursor: pointer;
margin: 0;
margin-bottom: $gl-padding;
font-size: 14px;
......@@ -19,12 +18,17 @@ $notification-box-shadow-color: rgba(0, 0, 0, 0.25);
}
}
.close-icon {
width: 16px;
height: 16px;
.close-icon-wrapper {
padding: ($gl-btn-padding + $gl-padding-4) $gl-padding $gl-btn-padding;
position: absolute;
right: $gl-padding;
top: $gl-padding;
right: 0;
top: 0;
cursor: pointer;
.close-icon {
width: 16px;
height: 16px;
}
}
.flash-notice,
......
# frozen_string_literal: true
module Types
class ExtendedIssueType < IssueType
graphql_name 'ExtendedIssue'
authorize :read_issue
expose_permissions Types::PermissionTypes::Issue
present_using IssuePresenter
field :subscribed, GraphQL::BOOLEAN_TYPE, method: :subscribed?, null: false, complexity: 5,
description: 'Boolean flag for whether the currently logged in user is subscribed to this issue'
end
end
......@@ -49,6 +49,11 @@ module Types
field :web_url, GraphQL::STRING_TYPE, null: false # rubocop:disable Graphql/Descriptions
field :relative_position, GraphQL::INT_TYPE, null: true # rubocop:disable Graphql/Descriptions
field :epic, ::Types::EpicType, null: true, description: 'The epic to which issue belongs'
field :participants, Types::UserType.connection_type, null: true, complexity: 5, description: 'List of participants for the issue'
field :time_estimate, GraphQL::INT_TYPE, null: false, description: 'The time estimate on the issue'
field :total_time_spent, GraphQL::INT_TYPE, null: false, description: 'Total time reported as spent on the issue'
field :closed_at, Types::TimeType, null: true # rubocop:disable Graphql/Descriptions
field :created_at, Types::TimeType, null: false # rubocop:disable Graphql/Descriptions
......
......@@ -92,7 +92,7 @@ module Types
resolver: Resolvers::IssuesResolver
field :issue, # rubocop:disable Graphql/Descriptions
Types::IssueType,
Types::ExtendedIssueType,
null: true,
resolver: Resolvers::IssuesResolver.single
......
......@@ -11,6 +11,10 @@ class IssuePresenter < Gitlab::View::Presenter::Delegated
url_builder.issue_path(issue)
end
def subscribed?
issue.subscribed?(current_user, issue.project)
end
private
def url_builder
......
......@@ -5,4 +5,5 @@
- if value
%div{ class: "flash-content flash-#{key} rounded" }
%span= value
= sprite_icon('close', size: 16, css_class: 'close-icon')
%div{ class: "close-icon-wrapper js-close-icon" }
= sprite_icon('close', size: 16, css_class: 'close-icon')
......@@ -28,7 +28,7 @@ restart()
stop
fi
killall
start_sidekiq -d -L $sidekiq_logfile >> $sidekiq_logfile 2>&1
start_sidekiq -P $sidekiq_pidfile -d -L $sidekiq_logfile >> $sidekiq_logfile 2>&1
}
start_no_deamonize()
......@@ -45,7 +45,7 @@ start_sidekiq()
cmd="${cmd} ${chpst} -P"
fi
${cmd} bundle exec sidekiq -C "${sidekiq_config}" -e $RAILS_ENV -P $sidekiq_pidfile "$@"
${cmd} bundle exec sidekiq -C "${sidekiq_config}" -e $RAILS_ENV "$@"
}
load_ok()
......
---
title: Add more attributes to issues GraphQL endpoint
merge_request: 17802
author:
type: changed
---
title: Banners should only be dismissable by clicking x button
merge_request: 17642
author:
type: changed
......@@ -28,18 +28,28 @@ either:
- Site-wide by modifying the settings in `gitlab.yml` and `gitlab.rb` for source
and Omnibus installations respectively.
NOTE: **Note:**
This only applies to pipelines run as part of GitLab CI/CD. This will not enable or disable
pipelines that are run from an [external integration](../user/project/integrations/project_services.md#services).
## Per-project user setting
The setting to enable or disable GitLab CI/CD can be found under your project's
**Settings > General > Permissions**. Choose one of "Disabled", "Only team members"
or "Everyone with access" and hit **Save changes** for the settings to take effect.
The setting to enable or disable GitLab CI/CD Pipelines can be found in your project in
**Settings > General > Visibility, project features, permissions**. If the project
visibility is set to:
- **Private**, only project members can access pipelines.
- **Internal** or **Public**, pipelines can be made accessible to either
project members only or everyone with access.
Press **Save changes** for the settings to take effect.
![Sharing & Permissions settings](../user/project/settings/img/sharing_and_permissions_settings.png)
![Sharing & Permissions settings](../user/project/settings/img/sharing_and_permissions_settings_v12_3.png)
## Site-wide admin setting
You can disable GitLab CI/CD site-wide, by modifying the settings in `gitlab.yml`
and `gitlab.rb` for source and Omnibus installations respectively.
for source installations, and `gitlab.rb` for Omnibus installations.
Two things to note:
......
......@@ -202,8 +202,36 @@ so we need to set some guidelines for their use going forward:
order is required, otherwise `let` will suffice. Remember that `let` is lazy and won't
be evaluated until it is referenced.
### `let_it_be` variables
In some cases there is no need to recreate the same object for tests
again for each example. For example, a project is needed to test issues
on the same project, one project will do for the entire file. This can
be achieved by using
[`let_it_be`](https://test-prof.evilmartians.io/#/let_it_be) variables
from the [`test-prof` gem](https://rubygems.org/gems/test-prof).
Note that if you modify an object defined inside a `let_it_be` block,
then you will need to reload the object as needed, or specify the `reload`
option to reload for every example.
```
let_it_be(:project, reload: true) { create(:project) }
```
You can also specify the `refind` option as well to completely load a
new object.
```
let_it_be(:project, refind: true) { create(:project) }
```
### `set` variables
NOTE: **Note:**
We are incrementally removing `set` in favour of `let_it_be`. See the
[removal issue](https://gitlab.com/gitlab-org/gitlab/issues/27922).
In some cases there is no need to recreate the same object for tests again for
each example. For example, a project is needed to test issues on the same
project, one project will do for the entire file. This can be achieved by using
......
......@@ -36,11 +36,19 @@ changes to be reviewed.
## Only allow merge requests to be merged if the pipeline succeeds
You can prevent merge requests from being merged if their pipeline did not succeed
or if there are threads to be resolved.
or if there are threads to be resolved. This works for both:
Navigate to your project's settings page and expand the **Merge requests** section.
In the **Merge checks** subsection, select the **Pipelines must succeed** check
box and hit **Save** for the changes to take effect.
- GitLab CI/CD pipelines
- Pipelines run from an [external CI integration](../integrations/project_services.md#services)
As a result, [disabling GitLab CI/CD pipelines](../../../ci/enable_or_disable_ci.md)
will not disable this feature, as it will still be possible to use pipelines from external
CI providers with this feature. To enable it, you must:
1. Navigate to your project's **Settings > General** page.
1. Expand the **Merge requests** section.
1. In the **Merge checks** subsection, select the **Pipelines must succeed** checkbox.
1. Press **Save** for the changes to take effect.
NOTE: **Note:** This setting also prevents merge requests from being merged if there is no pipeline.
......
......@@ -24,7 +24,7 @@ The project description also partially supports [standard markdown](../../markdo
Set up your project's access, [visibility](../../../public_access/public_access.md), and enable [Container Registry](../../packages/container_registry/index.md) for your projects:
![projects sharing permissions](img/sharing_and_permissions_settings.png)
![projects sharing permissions](img/sharing_and_permissions_settings_v12_3.png)
If Issues are disabled, or you can't access Issues because you're not a project member, then Labels and Milestones
links will be missing from the sidebar UI.
......
......@@ -469,7 +469,7 @@ describe Admin::ClustersController do
end
describe 'security' do
set(:cluster) { create(:cluster, :provided_by_gcp, :instance) }
let_it_be(:cluster) { create(:cluster, :provided_by_gcp, :instance) }
it { expect { put_update }.to be_allowed_for(:admin) }
it { expect { put_update }.to be_denied_for(:user) }
......@@ -531,7 +531,7 @@ describe Admin::ClustersController do
end
describe 'security' do
set(:cluster) { create(:cluster, :provided_by_gcp, :production_environment, :instance) }
let_it_be(:cluster) { create(:cluster, :provided_by_gcp, :production_environment, :instance) }
it { expect { delete_destroy }.to be_allowed_for(:admin) }
it { expect { delete_destroy }.to be_denied_for(:user) }
......
......@@ -3,7 +3,7 @@
require 'spec_helper'
describe Admin::RequestsProfilesController do
set(:admin) { create(:admin) }
let_it_be(:admin) { create(:admin) }
before do
sign_in(admin)
......
......@@ -4,7 +4,7 @@ require 'spec_helper'
describe Admin::UsersController do
let(:user) { create(:user) }
set(:admin) { create(:admin) }
let_it_be(:admin) { create(:admin) }
before do
sign_in(admin)
......
......@@ -6,7 +6,7 @@ describe Groups::ClustersController do
include AccessMatchersForController
include GoogleApi::CloudPlatformHelpers
set(:group) { create(:group) }
let_it_be(:group) { create(:group) }
let(:user) { create(:user) }
......@@ -536,7 +536,7 @@ describe Groups::ClustersController do
end
describe 'security' do
set(:cluster) { create(:cluster, :provided_by_gcp, cluster_type: :group_type, groups: [group]) }
let_it_be(:cluster) { create(:cluster, :provided_by_gcp, cluster_type: :group_type, groups: [group]) }
it { expect { go }.to be_allowed_for(:admin) }
it { expect { go }.to be_allowed_for(:owner).of(group) }
......@@ -604,7 +604,7 @@ describe Groups::ClustersController do
end
describe 'security' do
set(:cluster) { create(:cluster, :provided_by_gcp, :production_environment, cluster_type: :group_type, groups: [group]) }
let_it_be(:cluster) { create(:cluster, :provided_by_gcp, :production_environment, cluster_type: :group_type, groups: [group]) }
it { expect { go }.to be_allowed_for(:admin) }
it { expect { go }.to be_allowed_for(:owner).of(group) }
......
......@@ -3,9 +3,9 @@
require 'spec_helper'
describe Groups::LabelsController do
set(:group) { create(:group) }
set(:user) { create(:user) }
set(:project) { create(:project, namespace: group) }
let_it_be(:group) { create(:group) }
let_it_be(:user) { create(:user) }
let_it_be(:project) { create(:project, namespace: group) }
before do
group.add_owner(user)
......@@ -14,8 +14,8 @@ describe Groups::LabelsController do
end
describe 'GET #index' do
set(:label_1) { create(:label, project: project, title: 'label_1') }
set(:group_label_1) { create(:group_label, group: group, title: 'group_label_1') }
let_it_be(:label_1) { create(:label, project: project, title: 'label_1') }
let_it_be(:group_label_1) { create(:group_label, group: group, title: 'group_label_1') }
it 'returns group and project labels by default' do
get :index, params: { group_id: group }, format: :json
......@@ -25,8 +25,8 @@ describe Groups::LabelsController do
end
context 'with ancestor group' do
set(:subgroup) { create(:group, parent: group) }
set(:subgroup_label_1) { create(:group_label, group: subgroup, title: 'subgroup_label_1') }
let_it_be(:subgroup) { create(:group, parent: group) }
let_it_be(:subgroup_label_1) { create(:group_label, group: subgroup, title: 'subgroup_label_1') }
before do
subgroup.add_owner(user)
......
......@@ -17,9 +17,9 @@ describe Groups::SharedProjectsController do
).execute(group)
end
set(:group) { create(:group) }
set(:user) { create(:user) }
set(:shared_project) do
let_it_be(:group) { create(:group) }
let_it_be(:user) { create(:user) }
let_it_be(:shared_project) do
shared_project = create(:project, namespace: user.namespace)
share_project(shared_project)
......
......@@ -39,7 +39,7 @@ describe Import::BitbucketServerController do
assign_session_tokens
end
set(:project) { create(:project) }
let_it_be(:project) { create(:project) }
it 'returns the new project' do
allow(Gitlab::BitbucketServerImport::ProjectCreator)
......
......@@ -3,8 +3,8 @@
require 'spec_helper'
describe Import::GitlabProjectsController do
set(:namespace) { create(:namespace) }
set(:user) { namespace.owner }
let_it_be(:namespace) { create(:namespace) }
let_it_be(:user) { namespace.owner }
let(:file) { fixture_file_upload('spec/fixtures/project_export.tar.gz', 'text/plain') }
before do
......
......@@ -4,9 +4,9 @@ require 'spec_helper'
describe Projects::ArtifactsController do
let(:user) { project.owner }
set(:project) { create(:project, :repository, :public) }
let_it_be(:project) { create(:project, :repository, :public) }
set(:pipeline) do
let_it_be(:pipeline, reload: true) do
create(:ci_pipeline,
project: project,
sha: project.commit.sha,
......@@ -48,7 +48,7 @@ describe Projects::ArtifactsController do
it 'paginates artifacts' do
subject
expect(assigns(:artifacts)).to contain_exactly(project.job_artifacts.last)
expect(assigns(:artifacts)).to contain_exactly(project.reload.job_artifacts.last)
end
end
end
......
......@@ -3,10 +3,10 @@
require 'spec_helper'
describe Projects::AutocompleteSourcesController do
set(:group) { create(:group) }
set(:project) { create(:project, namespace: group) }
set(:issue) { create(:issue, project: project) }
set(:user) { create(:user) }
let_it_be(:group) { create(:group) }
let_it_be(:project) { create(:project, namespace: group) }
let_it_be(:issue) { create(:issue, project: project) }
let_it_be(:user) { create(:user) }
describe 'GET members' do
before do
......
......@@ -7,7 +7,7 @@ describe Projects::ClustersController do
include GoogleApi::CloudPlatformHelpers
include KubernetesHelpers
set(:project) { create(:project) }
let_it_be(:project) { create(:project) }
let(:user) { create(:user) }
......@@ -536,7 +536,7 @@ describe Projects::ClustersController do
end
describe 'security' do
set(:cluster) { create(:cluster, :provided_by_gcp, projects: [project]) }
let_it_be(:cluster) { create(:cluster, :provided_by_gcp, projects: [project]) }
it { expect { go }.to be_allowed_for(:admin) }
it { expect { go }.to be_allowed_for(:owner).of(project) }
......@@ -605,7 +605,7 @@ describe Projects::ClustersController do
end
describe 'security' do
set(:cluster) { create(:cluster, :provided_by_gcp, :production_environment, projects: [project]) }
let_it_be(:cluster) { create(:cluster, :provided_by_gcp, :production_environment, projects: [project]) }
it { expect { go }.to be_allowed_for(:admin) }
it { expect { go }.to be_allowed_for(:owner).of(project) }
......
......@@ -3,9 +3,10 @@
require 'spec_helper'
describe Projects::CommitController do
set(:project) { create(:project, :repository) }
set(:user) { create(:user) }
let(:commit) { project.commit("master") }
let_it_be(:project) { create(:project, :repository) }
let_it_be(:user) { create(:user) }
let(:commit) { project.commit("master") }
let(:master_pickable_sha) { '7d3b0f7cff5f37573aea97cebfd5692ea1689924' }
let(:master_pickable_commit) { project.commit(master_pickable_sha) }
......
......@@ -3,9 +3,9 @@
require 'spec_helper'
describe Projects::Environments::PrometheusApiController do
set(:project) { create(:project) }
set(:environment) { create(:environment, project: project) }
set(:user) { create(:user) }
let_it_be(:project) { create(:project) }
let_it_be(:environment) { create(:environment, project: project) }
let_it_be(:user) { create(:user) }
before do
project.add_reporter(user)
......
......@@ -5,10 +5,10 @@ require 'spec_helper'
describe Projects::EnvironmentsController do
include MetricsDashboardHelpers
set(:user) { create(:user) }
set(:project) { create(:project) }
let_it_be(:user) { create(:user) }
let_it_be(:project) { create(:project) }
set(:environment) do
let_it_be(:environment) do
create(:environment, name: 'production', project: project)
end
......
......@@ -3,8 +3,8 @@
require 'spec_helper'
describe Projects::ErrorTrackingController do
set(:project) { create(:project) }
set(:user) { create(:user) }
let_it_be(:project) { create(:project) }
let_it_be(:user) { create(:user) }
before do
sign_in(user)
......
......@@ -6,7 +6,7 @@ describe Projects::MirrorsController do
include ReactiveCachingHelpers
describe 'setting up a remote mirror' do
set(:project) { create(:project, :repository) }
let_it_be(:project) { create(:project, :repository) }
context 'when the current project is not a mirror' do
it 'allows to create a remote mirror' do
......
......@@ -5,9 +5,9 @@ require 'spec_helper'
describe Projects::PipelineSchedulesController do
include AccessMatchersForController
set(:user) { create(:user) }
set(:project) { create(:project, :public, :repository) }
set(:pipeline_schedule) { create(:ci_pipeline_schedule, project: project) }
let_it_be(:user) { create(:user) }
let_it_be(:project) { create(:project, :public, :repository) }
let_it_be(:pipeline_schedule) { create(:ci_pipeline_schedule, project: project) }
before do
project.add_developer(user)
......@@ -60,8 +60,6 @@ describe Projects::PipelineSchedulesController do
end
describe 'GET #new' do
set(:user) { create(:user) }
before do
project.add_developer(user)
sign_in(user)
......@@ -77,8 +75,6 @@ describe Projects::PipelineSchedulesController do
describe 'POST #create' do
describe 'functionality' do
set(:user) { create(:user) }
before do
project.add_developer(user)
sign_in(user)
......@@ -149,7 +145,6 @@ describe Projects::PipelineSchedulesController do
describe 'PUT #update' do
describe 'functionality' do
set(:user) { create(:user) }
let!(:pipeline_schedule) { create(:ci_pipeline_schedule, project: project, owner: user) }
before do
......@@ -383,7 +378,6 @@ describe Projects::PipelineSchedulesController do
end
describe 'POST #play', :clean_gitlab_redis_cache do
set(:user) { create(:user) }
let(:ref) { 'master' }
before do
......@@ -442,8 +436,6 @@ describe Projects::PipelineSchedulesController do
end
describe 'DELETE #destroy' do
set(:user) { create(:user) }
context 'when a developer makes the request' do
before do
project.add_developer(user)
......
......@@ -5,7 +5,7 @@ require 'spec_helper'
describe Projects::PipelinesController do
include ApiHelpers
set(:user) { create(:user) }
let_it_be(:user) { create(:user) }
let(:project) { create(:project, :public, :repository) }
let(:feature) { ProjectFeature::ENABLED }
......
......@@ -3,8 +3,8 @@
require 'spec_helper'
describe Projects::PipelinesSettingsController do
set(:user) { create(:user) }
set(:project_auto_devops) { create(:project_auto_devops) }
let_it_be(:user) { create(:user) }
let_it_be(:project_auto_devops) { create(:project_auto_devops) }
let(:project) { project_auto_devops.project }
before do
......
......@@ -3,8 +3,8 @@
require('spec_helper')
describe Projects::Settings::CiCdController do
set(:user) { create(:user) }
set(:project_auto_devops) { create(:project_auto_devops) }
let_it_be(:user) { create(:user) }
let_it_be(:project_auto_devops) { create(:project_auto_devops) }
let(:project) { project_auto_devops.project }
before do
......
......@@ -3,8 +3,8 @@
require 'spec_helper'
describe Projects::Settings::OperationsController do
set(:user) { create(:user) }
set(:project) { create(:project) }
let_it_be(:user) { create(:user) }
let_it_be(:project) { create(:project) }
before do
sign_in(user)
......
......@@ -3,8 +3,8 @@
require 'spec_helper'
describe Projects::WikisController do
set(:project) { create(:project, :public, :repository) }
set(:user) { project.owner }
let_it_be(:project) { create(:project, :public, :repository) }
let(:user) { project.owner }
let(:project_wiki) { ProjectWiki.new(project, user) }
let(:wiki) { project_wiki.wiki }
let(:wiki_title) { 'page title test' }
......
......@@ -149,7 +149,7 @@ describe ProjectsController do
end
context 'when the storage is not available', :broken_storage do
set(:project) { create(:project, :broken_storage) }
let_it_be(:project) { create(:project, :broken_storage) }
before do
project.add_developer(user)
......
......@@ -67,7 +67,7 @@ describe SearchController do
using RSpec::Parameterized::TableSyntax
render_views
set(:project) { create(:project, :public, :repository, :wiki_repo) }
let_it_be(:project) { create(:project, :public, :repository, :wiki_repo) }
before do
expect(::Gitlab::GitalyClient).to receive(:allow_ref_name_caching).and_call_original
......
......@@ -4,6 +4,6 @@ FactoryBot.define do
factory :abuse_report do
reporter factory: :user
user
message 'User sends spam'
message { 'User sends spam' }
end
end
......@@ -4,9 +4,9 @@
FactoryBot.define do
factory :appearance do
title "GitLab Community Edition"
description "Open source software to collaborate on code"
new_project_guidelines "Custom project guidelines"
title { "GitLab Community Edition" }
description { "Open source software to collaborate on code" }
new_project_guidelines { "Custom project guidelines" }
end
trait :with_logo do
......
......@@ -2,6 +2,6 @@
FactoryBot.define do
factory :application_setting do
default_projects_limit 42
default_projects_limit { 42 }
end
end
......@@ -2,7 +2,7 @@
FactoryBot.define do
factory :award_emoji do
name "thumbsup"
name { "thumbsup" }
user
awardable factory: :issue
......@@ -12,7 +12,7 @@ FactoryBot.define do
trait :upvote
trait :downvote do
name "thumbsdown"
name { "thumbsdown" }
end
end
end
......@@ -3,11 +3,11 @@
FactoryBot.define do
factory :board do
transient do
project nil
group nil
project_id nil
group_id nil
parent nil
project { nil }
group { nil }
project_id { nil }
group_id { nil }
parent { nil }
end
after(:build, :stub) do |board, evaluator|
......
......@@ -2,7 +2,7 @@
FactoryBot.define do
factory :broadcast_message do
message "MyText"
message { "MyText" }
starts_at { 1.day.ago }
ends_at { 1.day.from_now }
......
......@@ -5,8 +5,8 @@ FactoryBot.define do
user factory: :user
service factory: :service
team_id 'T0001'
team_domain 'Awesome Team'
team_id { 'T0001' }
team_domain { 'Awesome Team' }
sequence(:chat_id) { |n| "U#{n}" }
chat_name { generate(:username) }
......
......@@ -2,22 +2,26 @@
FactoryBot.define do
factory :ci_bridge, class: Ci::Bridge do
name 'bridge'
stage 'test'
stage_idx 0
ref 'master'
tag false
created_at 'Di 29. Okt 09:50:00 CET 2013'
status :created
name { 'bridge' }
stage { 'test' }
stage_idx { 0 }
ref { 'master' }
tag { false }
created_at { 'Di 29. Okt 09:50:00 CET 2013' }
status { :created }
pipeline factory: :ci_pipeline
trait :variables do
yaml_variables [{ key: 'BRIDGE', value: 'cross', public: true }]
yaml_variables do
[{ key: 'BRIDGE', value: 'cross', public: true }]
end
end
transient { downstream nil }
transient { upstream nil }
transient do
downstream { nil }
upstream { nil }
end
after(:build) do |bridge, evaluator|
bridge.project ||= bridge.pipeline.project
......
......@@ -3,14 +3,14 @@
FactoryBot.define do
factory :ci_build_trace_chunk, class: Ci::BuildTraceChunk do
build factory: :ci_build
chunk_index 0
data_store :redis
chunk_index { 0 }
data_store { :redis }
trait :redis_with_data do
data_store :redis
data_store { :redis }
transient do
initial_data 'test data'
initial_data { 'test data' }
end
after(:create) do |build_trace_chunk, evaluator|
......@@ -19,14 +19,14 @@ FactoryBot.define do
end
trait :redis_without_data do
data_store :redis
data_store { :redis }
end
trait :database_with_data do
data_store :database
data_store { :database}
transient do
initial_data 'test data'
initial_data { 'test data' }
end
after(:build) do |build_trace_chunk, evaluator|
......@@ -35,14 +35,14 @@ FactoryBot.define do
end
trait :database_without_data do
data_store :database
data_store { :database }
end
trait :fog_with_data do
data_store :fog
data_store { :fog }
transient do
initial_data 'test data'
initial_data { 'test data' }
end
after(:create) do |build_trace_chunk, evaluator|
......@@ -51,7 +51,7 @@ FactoryBot.define do
end
trait :fog_without_data do
data_store :fog
data_store { :fog }
end
end
end
......@@ -4,13 +4,13 @@ include ActionDispatch::TestProcess
FactoryBot.define do
factory :ci_build, class: Ci::Build do
name 'test'
stage 'test'
stage_idx 0
ref 'master'
tag false
protected false
created_at 'Di 29. Okt 09:50:00 CET 2013'
name { 'test' }
stage { 'test' }
stage_idx { 0 }
ref { 'master' }
tag { false }
add_attribute(:protected) { false }
created_at { 'Di 29. Okt 09:50:00 CET 2013' }
pending
options do
......@@ -30,127 +30,127 @@ FactoryBot.define do
pipeline factory: :ci_pipeline
trait :degenerated do
options nil
yaml_variables nil
options { nil }
yaml_variables { nil }
end
trait :started do
started_at 'Di 29. Okt 09:51:28 CET 2013'
started_at { 'Di 29. Okt 09:51:28 CET 2013' }
end
trait :finished do
started
finished_at 'Di 29. Okt 09:53:28 CET 2013'
finished_at { 'Di 29. Okt 09:53:28 CET 2013' }
end
trait :success do
finished
status 'success'
status { 'success' }
end
trait :failed do
finished
status 'failed'
status { 'failed' }
end
trait :canceled do
finished
status 'canceled'
status { 'canceled' }
end
trait :skipped do
started
status 'skipped'
status { 'skipped' }
end
trait :running do
started
status 'running'
status { 'running' }
end
trait :pending do
queued_at 'Di 29. Okt 09:50:59 CET 2013'
status 'pending'
queued_at { 'Di 29. Okt 09:50:59 CET 2013' }
status { 'pending' }
end
trait :created do
status 'created'
status { 'created' }
end
trait :preparing do
status 'preparing'
status { 'preparing' }
end
trait :scheduled do
schedulable
status 'scheduled'
status { 'scheduled' }
scheduled_at { 1.minute.since }
end
trait :expired_scheduled do
schedulable
status 'scheduled'
status { 'scheduled' }
scheduled_at { 1.minute.ago }
end
trait :manual do
status 'manual'
self.when 'manual'
status { 'manual' }
self.when { 'manual' }
end
trait :teardown_environment do
environment 'staging'
environment { 'staging' }
options do
{
script: %w(ls),
environment: { name: 'staging',
action: 'stop',
url: 'http://staging.example.com/$CI_JOB_NAME' }
action: 'stop',
url: 'http://staging.example.com/$CI_JOB_NAME' }
}
end
end
trait :deploy_to_production do
environment 'production'
environment { 'production' }
options do
{
script: %w(ls),
environment: { name: 'production',
url: 'http://prd.example.com/$CI_JOB_NAME' }
url: 'http://prd.example.com/$CI_JOB_NAME' }
}
end
end
trait :start_review_app do
environment 'review/$CI_COMMIT_REF_NAME'
environment { 'review/$CI_COMMIT_REF_NAME' }
options do
{
script: %w(ls),
environment: { name: 'review/$CI_COMMIT_REF_NAME',
url: 'http://staging.example.com/$CI_JOB_NAME',
on_stop: 'stop_review_app' }
url: 'http://staging.example.com/$CI_JOB_NAME',
on_stop: 'stop_review_app' }
}
end
end
trait :stop_review_app do
name 'stop_review_app'
environment 'review/$CI_COMMIT_REF_NAME'
name { 'stop_review_app' }
environment { 'review/$CI_COMMIT_REF_NAME' }
options do
{
script: %w(ls),
environment: { name: 'review/$CI_COMMIT_REF_NAME',
url: 'http://staging.example.com/$CI_JOB_NAME',
action: 'stop' }
url: 'http://staging.example.com/$CI_JOB_NAME',
action: 'stop' }
}
end
end
trait :allowed_to_fail do
allow_failure true
allow_failure { true }
end
trait :ignored do
......@@ -166,7 +166,7 @@ FactoryBot.define do
end
trait :schedulable do
self.when 'delayed'
self.when { 'delayed' }
options do
{
......@@ -177,11 +177,11 @@ FactoryBot.define do
end
trait :actionable do
self.when 'manual'
self.when { 'manual' }
end
trait :retried do
retried true
retried { true }
end
trait :cancelable do
......@@ -194,11 +194,13 @@ FactoryBot.define do
end
trait :tags do
tag_list [:docker, :ruby]
tag_list do
[:docker, :ruby]
end
end
trait :on_tag do
tag true
tag { true }
end
trait :triggered do
......@@ -210,12 +212,12 @@ FactoryBot.define do
end
trait :tag do
tag true
tag { true }
end
trait :coverage do
coverage 99.9
coverage_regex '/(d+)/'
coverage { 99.9 }
coverage_regex { '/(d+)/' }
end
trait :trace_live do
......@@ -303,23 +305,23 @@ FactoryBot.define do
trait :extended_options do
options do
{
image: { name: 'ruby:2.1', entrypoint: '/bin/sh' },
services: ['postgres', { name: 'docker:stable-dind', entrypoint: '/bin/sh', command: 'sleep 30', alias: 'docker' }],
script: %w(echo),
after_script: %w(ls date),
artifacts: {
name: 'artifacts_file',
untracked: false,
paths: ['out/'],
when: 'always',
expire_in: '7d'
},
cache: {
key: 'cache_key',
untracked: false,
paths: ['vendor/*'],
policy: 'pull-push'
}
image: { name: 'ruby:2.1', entrypoint: '/bin/sh' },
services: ['postgres', { name: 'docker:stable-dind', entrypoint: '/bin/sh', command: 'sleep 30', alias: 'docker' }],
script: %w(echo),
after_script: %w(ls date),
artifacts: {
name: 'artifacts_file',
untracked: false,
paths: ['out/'],
when: 'always',
expire_in: '7d'
},
cache: {
key: 'cache_key',
untracked: false,
paths: ['vendor/*'],
policy: 'pull-push'
}
}
end
end
......@@ -329,27 +331,27 @@ FactoryBot.define do
end
trait :non_playable do
status 'created'
self.when 'manual'
status { 'created' }
self.when { 'manual' }
end
trait :protected do
protected true
add_attribute(:protected) { true }
end
trait :script_failure do
failed
failure_reason 1
failure_reason { 1 }
end
trait :api_failure do
failed
failure_reason 2
failure_reason { 2 }
end
trait :prerequisite_failure do
failed
failure_reason 10
failure_reason { 10 }
end
trait :with_runner_session do
......
......@@ -3,11 +3,11 @@
FactoryBot.define do
factory :ci_group_variable, class: Ci::GroupVariable do
sequence(:key) { |n| "VARIABLE_#{n}" }
value 'VARIABLE_VALUE'
masked false
value { 'VARIABLE_VALUE' }
masked { false }
trait(:protected) do
protected true
add_attribute(:protected) { true }
end
group factory: :group
......
......@@ -5,15 +5,15 @@ include ActionDispatch::TestProcess
FactoryBot.define do
factory :ci_job_artifact, class: Ci::JobArtifact do
job factory: :ci_build
file_type :archive
file_format :zip
file_type { :archive }
file_format { :zip }
trait :expired do
expire_at { Date.yesterday }
end
trait :remote_store do
file_store JobArtifactUploader::Store::REMOTE
file_store { JobArtifactUploader::Store::REMOTE}
end
after :build do |artifact|
......@@ -21,7 +21,7 @@ FactoryBot.define do
end
trait :raw do
file_format :raw
file_format { :raw }
after(:build) do |artifact, _|
artifact.file = fixture_file_upload(
......@@ -30,7 +30,7 @@ FactoryBot.define do
end
trait :zip do
file_format :zip
file_format { :zip }
after(:build) do |artifact, _|
artifact.file = fixture_file_upload(
......@@ -39,7 +39,7 @@ FactoryBot.define do
end
trait :gzip do
file_format :gzip
file_format { :gzip }
after(:build) do |artifact, _|
artifact.file = fixture_file_upload(
......@@ -48,8 +48,8 @@ FactoryBot.define do
end
trait :archive do
file_type :archive
file_format :zip
file_type { :archive }
file_format { :zip }
transient do
file { fixture_file_upload(Rails.root.join('spec/fixtures/ci_build_artifacts.zip'), 'application/zip') }
......@@ -63,12 +63,12 @@ FactoryBot.define do
trait :legacy_archive do
archive
file_location :legacy_path
file_location { :legacy_path }
end
trait :metadata do
file_type :metadata
file_format :gzip
file_type { :metadata }
file_format { :gzip }
transient do
file { fixture_file_upload(Rails.root.join('spec/fixtures/ci_build_artifacts_metadata.gz'), 'application/x-gzip') }
......@@ -80,8 +80,8 @@ FactoryBot.define do
end
trait :trace do
file_type :trace
file_format :raw
file_type { :trace }
file_format { :raw }
after(:build) do |artifact, evaluator|
artifact.file = fixture_file_upload(
......@@ -90,8 +90,8 @@ FactoryBot.define do
end
trait :junit do
file_type :junit
file_format :gzip
file_type { :junit }
file_format { :gzip }
after(:build) do |artifact, evaluator|
artifact.file = fixture_file_upload(
......@@ -100,8 +100,8 @@ FactoryBot.define do
end
trait :junit_with_ant do
file_type :junit
file_format :gzip
file_type { :junit }
file_format { :gzip }
after(:build) do |artifact, evaluator|
artifact.file = fixture_file_upload(
......@@ -110,8 +110,8 @@ FactoryBot.define do
end
trait :junit_with_three_testsuites do
file_type :junit
file_format :gzip
file_type { :junit }
file_format { :gzip }
after(:build) do |artifact, evaluator|
artifact.file = fixture_file_upload(
......@@ -120,8 +120,8 @@ FactoryBot.define do
end
trait :junit_with_corrupted_data do
file_type :junit
file_format :gzip
file_type { :junit }
file_format { :gzip }
after(:build) do |artifact, evaluator|
artifact.file = fixture_file_upload(
......@@ -130,8 +130,8 @@ FactoryBot.define do
end
trait :codequality do
file_type :codequality
file_format :raw
file_type { :codequality }
file_format { :raw }
after(:build) do |artifact, evaluator|
artifact.file = fixture_file_upload(
......
......@@ -3,7 +3,7 @@
FactoryBot.define do
factory :ci_job_variable, class: Ci::JobVariable do
sequence(:key) { |n| "VARIABLE_#{n}" }
value 'VARIABLE_VALUE'
value { 'VARIABLE_VALUE' }
job factory: :ci_build
end
......
......@@ -2,40 +2,40 @@
FactoryBot.define do
factory :ci_pipeline_schedule, class: Ci::PipelineSchedule do
cron '0 1 * * *'
cron_timezone Gitlab::Ci::CronParser::VALID_SYNTAX_SAMPLE_TIME_ZONE
ref 'master'
active true
description "pipeline schedule"
cron { '0 1 * * *' }
cron_timezone { Gitlab::Ci::CronParser::VALID_SYNTAX_SAMPLE_TIME_ZONE }
ref { 'master' }
active { true }
description { "pipeline schedule" }
project
trait :every_minute do
cron '*/1 * * * *'
cron_timezone Gitlab::Ci::CronParser::VALID_SYNTAX_SAMPLE_TIME_ZONE
cron { '*/1 * * * *' }
cron_timezone { Gitlab::Ci::CronParser::VALID_SYNTAX_SAMPLE_TIME_ZONE }
end
trait :hourly do
cron '* */1 * * *'
cron_timezone Gitlab::Ci::CronParser::VALID_SYNTAX_SAMPLE_TIME_ZONE
cron { '* */1 * * *' }
cron_timezone { Gitlab::Ci::CronParser::VALID_SYNTAX_SAMPLE_TIME_ZONE }
end
trait :nightly do
cron '0 1 * * *'
cron_timezone Gitlab::Ci::CronParser::VALID_SYNTAX_SAMPLE_TIME_ZONE
cron { '0 1 * * *' }
cron_timezone { Gitlab::Ci::CronParser::VALID_SYNTAX_SAMPLE_TIME_ZONE }
end
trait :weekly do
cron '0 1 * * 6'
cron_timezone Gitlab::Ci::CronParser::VALID_SYNTAX_SAMPLE_TIME_ZONE
cron { '0 1 * * 6' }
cron_timezone { Gitlab::Ci::CronParser::VALID_SYNTAX_SAMPLE_TIME_ZONE }
end
trait :monthly do
cron '0 1 22 * *'
cron_timezone Gitlab::Ci::CronParser::VALID_SYNTAX_SAMPLE_TIME_ZONE
cron { '0 1 22 * *' }
cron_timezone { Gitlab::Ci::CronParser::VALID_SYNTAX_SAMPLE_TIME_ZONE }
end
trait :inactive do
active false
active { false }
end
end
end
......@@ -3,8 +3,8 @@
FactoryBot.define do
factory :ci_pipeline_schedule_variable, class: Ci::PipelineScheduleVariable do
sequence(:key) { |n| "VARIABLE_#{n}" }
value 'VARIABLE_VALUE'
variable_type 'env_var'
value { 'VARIABLE_VALUE' }
variable_type { 'env_var' }
pipeline_schedule factory: :ci_pipeline_schedule
end
......
......@@ -3,7 +3,7 @@
FactoryBot.define do
factory :ci_pipeline_variable, class: Ci::PipelineVariable do
sequence(:key) { |n| "VARIABLE_#{n}" }
value 'VARIABLE_VALUE'
value { 'VARIABLE_VALUE' }
pipeline factory: :ci_empty_pipeline
end
......
......@@ -2,11 +2,11 @@
FactoryBot.define do
factory :ci_empty_pipeline, class: Ci::Pipeline do
source :push
ref 'master'
sha '97de212e80737a608d939f648d959671fb0a0142'
status 'pending'
protected false
source { :push }
ref { 'master' }
sha { '97de212e80737a608d939f648d959671fb0a0142' }
status { 'pending' }
add_attribute(:protected) { false }
project
......@@ -26,7 +26,7 @@ FactoryBot.define do
# Persist merge request head_pipeline_id
# on pipeline factories to avoid circular references
transient { head_pipeline_of nil }
transient { head_pipeline_of { nil } }
after(:create) do |pipeline, evaluator|
merge_request = evaluator.head_pipeline_of
......@@ -34,7 +34,7 @@ FactoryBot.define do
end
factory :ci_pipeline do
transient { config nil }
transient { config { nil } }
after(:build) do |pipeline, evaluator|
if evaluator.config
......@@ -48,44 +48,47 @@ FactoryBot.define do
end
trait :invalid do
config(rspec: nil)
failure_reason :config_error
config do
{ rspec: nil }
end
failure_reason { :config_error }
end
trait :created do
status :created
status { :created }
end
trait :preparing do
status :preparing
status { :preparing }
end
trait :blocked do
status :manual
status { :manual }
end
trait :scheduled do
status :scheduled
status { :scheduled }
end
trait :success do
status :success
status { :success }
end
trait :running do
status :running
status { :running }
end
trait :failed do
status :failed
status { :failed }
end
trait :protected do
protected true
add_attribute(:protected) { true }
end
trait :with_test_reports do
status :success
status { :success }
after(:build) do |pipeline, evaluator|
pipeline.builds << build(:ci_build, :test_reports, pipeline: pipeline, project: pipeline.project)
......
......@@ -4,22 +4,22 @@ FactoryBot.define do
factory :ci_runner, class: Ci::Runner do
sequence(:description) { |n| "My runner#{n}" }
platform "darwin"
active true
access_level :not_protected
platform { "darwin" }
active { true }
access_level { :not_protected }
runner_type :instance_type
runner_type { :instance_type }
trait :online do
contacted_at { Time.now }
end
trait :instance do
runner_type :instance_type
runner_type { :instance_type }
end
trait :group do
runner_type :group_type
runner_type { :group_type }
after(:build) do |runner, evaluator|
runner.groups << build(:group) if runner.groups.empty?
......@@ -27,7 +27,7 @@ FactoryBot.define do
end
trait :project do
runner_type :project_type
runner_type { :project_type }
after(:build) do |runner, evaluator|
runner.projects << build(:project) if runner.projects.empty?
......@@ -43,21 +43,21 @@ FactoryBot.define do
end
trait :inactive do
active false
active { false }
end
trait :ref_protected do
access_level :ref_protected
access_level { :ref_protected }
end
trait :tagged_only do
run_untagged false
run_untagged { false }
tag_list %w(tag1 tag2)
tag_list { %w(tag1 tag2) }
end
trait :locked do
locked true
locked { true }
end
end
end
......@@ -5,16 +5,16 @@ FactoryBot.define do
skip_create
transient do
name 'test'
status nil
warnings nil
name { 'test' }
status { nil }
warnings { nil }
pipeline factory: :ci_empty_pipeline
end
initialize_with do
Ci::LegacyStage.new(pipeline, name: name,
status: status,
warnings: warnings)
status: status,
warnings: warnings)
end
end
......@@ -22,8 +22,8 @@ FactoryBot.define do
project factory: :project
pipeline factory: :ci_empty_pipeline
name 'test'
position 1
status 'pending'
name { 'test' }
position { 1 }
status { 'pending' }
end
end
......@@ -3,11 +3,11 @@
FactoryBot.define do
factory :ci_variable, class: Ci::Variable do
sequence(:key) { |n| "VARIABLE_#{n}" }
value 'VARIABLE_VALUE'
masked false
value { 'VARIABLE_VALUE' }
masked { false }
trait(:protected) do
protected true
add_attribute(:protected) { true }
end
project
......
......@@ -19,50 +19,50 @@ FactoryBot.define do
end
trait :not_installable do
status(-2)
status { -2 }
end
trait :errored do
status(-1)
status_reason 'something went wrong'
status { -1 }
status_reason { 'something went wrong' }
end
trait :installable do
status 0
status { 0 }
end
trait :scheduled do
status 1
status { 1 }
end
trait :installing do
status 2
status { 2 }
end
trait :installed do
status 3
status { 3 }
end
trait :updating do
status 4
status { 4 }
end
trait :updated do
status 5
status { 5 }
end
trait :update_errored do
status(6)
status_reason 'something went wrong'
status { 6 }
status_reason { 'something went wrong' }
end
trait :uninstalling do
status 7
status { 7 }
end
trait :uninstall_errored do
status(8)
status_reason 'something went wrong'
status { 8 }
status_reason { 'something went wrong' }
end
trait :timed_out do
......@@ -75,7 +75,7 @@ FactoryBot.define do
end
factory :clusters_applications_cert_manager, class: Clusters::Applications::CertManager do
email 'admin@example.com'
email { 'admin@example.com' }
cluster factory: %i(cluster with_installed_helm provided_by_gcp)
end
......@@ -89,7 +89,7 @@ FactoryBot.define do
end
factory :clusters_applications_knative, class: Clusters::Applications::Knative do
hostname 'example.com'
hostname { 'example.com' }
cluster factory: %i(cluster with_installed_helm provided_by_gcp)
end
......
......@@ -3,10 +3,10 @@
FactoryBot.define do
factory :cluster, class: Clusters::Cluster do
user
name 'test-cluster'
cluster_type :project_type
managed true
namespace_per_environment true
name { 'test-cluster' }
cluster_type { :project_type }
managed { true }
namespace_per_environment { true }
factory :cluster_for_group, traits: [:provided_by_gcp, :group]
......@@ -31,26 +31,26 @@ FactoryBot.define do
end
trait :namespace_per_environment_disabled do
namespace_per_environment false
namespace_per_environment { false }
end
trait :provided_by_user do
provider_type :user
platform_type :kubernetes
provider_type { :user }
platform_type { :kubernetes }
platform_kubernetes factory: [:cluster_platform_kubernetes, :configured]
end
trait :provided_by_gcp do
provider_type :gcp
platform_type :kubernetes
provider_type { :gcp }
platform_type { :kubernetes }
provider_gcp factory: [:cluster_provider_gcp, :created]
platform_kubernetes factory: [:cluster_platform_kubernetes, :configured]
end
trait :providing_by_gcp do
provider_type :gcp
provider_type { :gcp }
provider_gcp factory: [:cluster_provider_gcp, :creating]
end
......@@ -63,7 +63,7 @@ FactoryBot.define do
end
trait :disabled do
enabled false
enabled { false }
end
trait :production_environment do
......@@ -75,11 +75,11 @@ FactoryBot.define do
end
trait :with_domain do
domain 'example.com'
domain { 'example.com' }
end
trait :not_managed do
managed false
managed { false }
end
end
end
......@@ -27,7 +27,7 @@ FactoryBot.define do
end
trait :without_token do
service_account_token nil
service_account_token { nil }
end
end
end
......@@ -3,14 +3,14 @@
FactoryBot.define do
factory :cluster_platform_kubernetes, class: Clusters::Platforms::Kubernetes do
cluster
namespace nil
api_url 'https://kubernetes.example.com'
namespace { nil }
api_url { 'https://kubernetes.example.com' }
token { 'a' * 40 }
trait :configured do
api_url 'https://kubernetes.example.com'
username 'xxxxxx'
password 'xxxxxx'
api_url { 'https://kubernetes.example.com' }
username { 'xxxxxx' }
password { 'xxxxxx' }
before(:create) do |platform_kubernetes, evaluator|
pem_file = File.expand_path(Rails.root.join('spec/fixtures/clusters/sample_cert.pem'))
......@@ -19,7 +19,7 @@ FactoryBot.define do
end
trait :rbac_disabled do
authorization_type :abac
authorization_type { :abac }
end
end
end
......@@ -3,14 +3,14 @@
FactoryBot.define do
factory :cluster_provider_gcp, class: Clusters::Providers::Gcp do
cluster
gcp_project_id 'test-gcp-project'
gcp_project_id { 'test-gcp-project' }
trait :scheduled do
access_token 'access_token_123'
access_token { 'access_token_123' }
end
trait :creating do
access_token 'access_token_123'
access_token { 'access_token_123' }
after(:build) do |gcp, evaluator|
gcp.make_creating('operation-123')
......@@ -18,7 +18,7 @@ FactoryBot.define do
end
trait :created do
endpoint '111.111.111.111'
endpoint { '111.111.111.111' }
after(:build) do |gcp, evaluator|
gcp.make_created
......@@ -32,11 +32,11 @@ FactoryBot.define do
end
trait :abac_enabled do
legacy_abac true
legacy_abac { true }
end
trait :cloud_run_enabled do
cloud_run true
cloud_run { true }
end
end
end
......@@ -2,53 +2,53 @@
FactoryBot.define do
factory :commit_status, class: CommitStatus do
name 'default'
stage 'test'
stage_idx 0
status 'success'
description 'commit status'
name { 'default' }
stage { 'test' }
stage_idx { 0 }
status { 'success' }
description { 'commit status'}
pipeline factory: :ci_pipeline_with_one_job
started_at 'Tue, 26 Jan 2016 08:21:42 +0100'
finished_at 'Tue, 26 Jan 2016 08:23:42 +0100'
started_at { 'Tue, 26 Jan 2016 08:21:42 +0100'}
finished_at { 'Tue, 26 Jan 2016 08:23:42 +0100'}
trait :success do
status 'success'
status { 'success' }
end
trait :failed do
status 'failed'
status { 'failed' }
end
trait :canceled do
status 'canceled'
status { 'canceled' }
end
trait :skipped do
status 'skipped'
status { 'skipped' }
end
trait :running do
status 'running'
status { 'running' }
end
trait :pending do
status 'pending'
status { 'pending' }
end
trait :preparing do
status 'preparing'
status { 'preparing' }
end
trait :created do
status 'created'
status { 'created' }
end
trait :manual do
status 'manual'
status { 'manual' }
end
trait :scheduled do
status 'scheduled'
status { 'scheduled' }
end
after(:build) do |build, evaluator|
......@@ -56,8 +56,8 @@ FactoryBot.define do
end
factory :generic_commit_status, class: GenericCommitStatus do
name 'generic'
description 'external commit status'
name { 'generic' }
description { 'external commit status' }
end
end
end
......@@ -5,7 +5,7 @@ require_relative '../support/helpers/repo_helpers'
FactoryBot.define do
factory :commit do
transient do
author nil
author { nil }
end
git_commit do
......
......@@ -6,11 +6,11 @@ FactoryBot.define do
project
transient do
tags []
tags { [] }
end
trait :root do
name ''
name { '' }
end
after(:build) do |repository, evaluator|
......
......@@ -2,44 +2,44 @@
FactoryBot.define do
factory :conversational_development_index_metric, class: ConversationalDevelopmentIndex::Metric do
leader_issues 9.256
instance_issues 1.234
percentage_issues 13.331
leader_issues { 9.256 }
instance_issues { 1.234 }
percentage_issues { 13.331 }
leader_notes 30.33333
instance_notes 28.123
percentage_notes 92.713
leader_notes { 30.33333 }
instance_notes { 28.123 }
percentage_notes { 92.713 }
leader_milestones 16.2456
instance_milestones 1.234
percentage_milestones 7.595
leader_milestones { 16.2456 }
instance_milestones { 1.234 }
percentage_milestones { 7.595 }
leader_boards 5.2123
instance_boards 3.254
percentage_boards 62.429
leader_boards { 5.2123 }
instance_boards { 3.254 }
percentage_boards { 62.429 }
leader_merge_requests 1.2
instance_merge_requests 0.6
percentage_merge_requests 50.0
leader_merge_requests { 1.2 }
instance_merge_requests { 0.6 }
percentage_merge_requests { 50.0 }
leader_ci_pipelines 12.1234
instance_ci_pipelines 2.344
percentage_ci_pipelines 19.334
leader_ci_pipelines { 12.1234 }
instance_ci_pipelines { 2.344 }
percentage_ci_pipelines { 19.334 }
leader_environments 3.3333
instance_environments 2.2222
percentage_environments 66.672
leader_environments { 3.3333 }
instance_environments { 2.2222 }
percentage_environments { 66.672 }
leader_deployments 1.200
instance_deployments 0.771
percentage_deployments 64.25
leader_deployments { 1.200 }
instance_deployments { 0.771 }
percentage_deployments { 64.25 }
leader_projects_prometheus_active 0.111
instance_projects_prometheus_active 0.109
percentage_projects_prometheus_active 98.198
leader_projects_prometheus_active { 0.111 }
instance_projects_prometheus_active { 0.109 }
percentage_projects_prometheus_active { 98.198 }
leader_service_desk_issues 15.891
instance_service_desk_issues 13.345
percentage_service_desk_issues 83.978
leader_service_desk_issues { 15.891 }
instance_service_desk_issues { 13.345 }
percentage_service_desk_issues { 83.978 }
end
end
......@@ -6,7 +6,7 @@ FactoryBot.define do
project
trait :write_access do
can_push true
can_push { true }
end
end
end
......@@ -2,20 +2,20 @@
FactoryBot.define do
factory :deploy_token do
token nil
token_encrypted { Gitlab::CryptoHelper.aes256_gcm_encrypt( SecureRandom.hex(50) ) }
token { nil }
token_encrypted { Gitlab::CryptoHelper.aes256_gcm_encrypt(SecureRandom.hex(50)) }
sequence(:name) { |n| "PDT #{n}" }
read_repository true
read_registry true
revoked false
read_repository { true }
read_registry { true }
revoked { false }
expires_at { 5.days.from_now }
trait :revoked do
revoked true
revoked { true }
end
trait :gitlab_deploy_token do
name DeployToken::GITLAB_DEPLOY_TOKEN_NAME
name { DeployToken::GITLAB_DEPLOY_TOKEN_NAME }
end
trait :expired do
......
......@@ -2,11 +2,11 @@
FactoryBot.define do
factory :deployment, class: Deployment do
sha 'b83d6e391c22777fca1ed3012fce84f633d7fed0'
ref 'master'
tag false
user nil
project nil
sha { 'b83d6e391c22777fca1ed3012fce84f633d7fed0' }
ref { 'master' }
tag { false }
user { nil }
project { nil }
deployable factory: :ci_build
environment factory: :environment
......@@ -25,7 +25,7 @@ FactoryBot.define do
trait :review_app do
sha { TestEnv::BRANCH_SHA['pages-deploy'] }
ref 'pages-deploy'
ref { 'pages-deploy' }
end
trait :on_cluster do
......@@ -33,21 +33,21 @@ FactoryBot.define do
end
trait :running do
status :running
status { :running }
end
trait :success do
status :success
status { :success }
finished_at { Time.now }
end
trait :failed do
status :failed
status { :failed }
finished_at { Time.now }
end
trait :canceled do
status :canceled
status { :canceled }
finished_at { Time.now }
end
......
......@@ -9,7 +9,7 @@ FactoryBot.define do
trait :with_review_app do |environment|
transient do
ref 'master'
ref { 'master' }
end
# At this point `review app` is an ephemeral concept related to
......@@ -41,8 +41,8 @@ FactoryBot.define do
end
trait :non_playable do
status 'created'
self.when 'manual'
status { 'created' }
self.when { 'manual' }
end
end
end
......@@ -2,22 +2,22 @@
FactoryBot.define do
factory :error_tracking_error, class: Gitlab::ErrorTracking::Error do
id 'id'
title 'title'
type 'error'
user_count 1
count 2
id { 'id' }
title { 'title' }
type { 'error' }
user_count { 1 }
count { 2 }
first_seen { Time.now }
last_seen { Time.now }
message 'message'
culprit 'culprit'
external_url 'http://example.com/id'
project_id 'project1'
project_name 'project name'
project_slug 'project_name'
short_id 'ID'
status 'unresolved'
frequency []
message { 'message' }
culprit { 'culprit' }
external_url { 'http://example.com/id' }
project_id { 'project1' }
project_name { 'project name' }
project_slug { 'project_name' }
short_id { 'ID' }
status { 'unresolved' }
frequency { [] }
skip_create
end
......
......@@ -2,13 +2,13 @@
FactoryBot.define do
factory :error_tracking_project, class: Gitlab::ErrorTracking::Project do
id '1'
name 'Sentry Example'
slug 'sentry-example'
status 'active'
organization_name 'Sentry'
organization_id '1'
organization_slug 'sentry'
id { '1' }
name { 'Sentry Example' }
slug { 'sentry-example' }
status { 'active' }
organization_name { 'Sentry' }
organization_id { '1' }
organization_slug { 'sentry' }
skip_create
end
......
......@@ -4,19 +4,19 @@ FactoryBot.define do
factory :event do
project
author(factory: :user) { project.creator }
action Event::JOINED
action { Event::JOINED }
trait(:created) { action Event::CREATED }
trait(:updated) { action Event::UPDATED }
trait(:closed) { action Event::CLOSED }
trait(:reopened) { action Event::REOPENED }
trait(:pushed) { action Event::PUSHED }
trait(:commented) { action Event::COMMENTED }
trait(:merged) { action Event::MERGED }
trait(:joined) { action Event::JOINED }
trait(:left) { action Event::LEFT }
trait(:destroyed) { action Event::DESTROYED }
trait(:expired) { action Event::EXPIRED }
trait(:created) { action { Event::CREATED } }
trait(:updated) { action { Event::UPDATED } }
trait(:closed) { action { Event::CLOSED } }
trait(:reopened) { action { Event::REOPENED } }
trait(:pushed) { action { Event::PUSHED } }
trait(:commented) { action { Event::COMMENTED } }
trait(:merged) { action { Event::MERGED } }
trait(:joined) { action { Event::JOINED } }
trait(:left) { action { Event::LEFT } }
trait(:destroyed) { action { Event::DESTROYED } }
trait(:expired) { action { Event::EXPIRED } }
factory :closed_issue_event do
action { Event::CLOSED }
......@@ -27,15 +27,15 @@ FactoryBot.define do
factory :push_event, class: PushEvent do
project factory: :project_empty_repo
author(factory: :user) { project.creator }
action Event::PUSHED
action { Event::PUSHED }
end
factory :push_event_payload do
event
commit_count 1
action :pushed
ref_type :branch
ref 'master'
commit_to '3cdce97ed87c91368561584e7358f4d46e3e173c'
commit_count { 1 }
action { :pushed }
ref_type { :branch }
ref { 'master' }
commit_to { '3cdce97ed87c91368561584e7358f4d46e3e173c' }
end
end
......@@ -4,14 +4,14 @@ FactoryBot.define do
factory :external_pull_request do
sequence(:pull_request_iid)
project
source_branch 'feature'
source_repository 'the-repository'
source_sha '97de212e80737a608d939f648d959671fb0a0142'
target_branch 'master'
target_repository 'the-repository'
target_sha 'a09386439ca39abe575675ffd4b89ae824fec22f'
status :open
source_branch { 'feature' }
source_repository { 'the-repository' }
source_sha { '97de212e80737a608d939f648d959671fb0a0142' }
target_branch { 'master' }
target_repository { 'the-repository' }
target_sha { 'a09386439ca39abe575675ffd4b89ae824fec22f' }
status { :open }
trait(:closed) { status 'closed' }
trait(:closed) { status { 'closed'} }
end
end
......@@ -5,7 +5,7 @@ FactoryBot.define do
skip_create
project
secret nil
secret { nil }
transient do
fixture { 'rails_sample.jpg' }
......
......@@ -6,6 +6,6 @@ FactoryBot.define do
project
gpg_key
gpg_key_primary_keyid { gpg_key.keyid }
verification_status :verified
verification_status { :verified }
end
end
......@@ -6,23 +6,23 @@ FactoryBot.define do
group
user
trait(:guest) { access_level GroupMember::GUEST }
trait(:reporter) { access_level GroupMember::REPORTER }
trait(:developer) { access_level GroupMember::DEVELOPER }
trait(:maintainer) { access_level GroupMember::MAINTAINER }
trait(:owner) { access_level GroupMember::OWNER }
trait(:guest) { access_level { GroupMember::GUEST } }
trait(:reporter) { access_level { GroupMember::REPORTER } }
trait(:developer) { access_level { GroupMember::DEVELOPER } }
trait(:maintainer) { access_level { GroupMember::MAINTAINER } }
trait(:owner) { access_level { GroupMember::OWNER } }
trait(:access_request) { requested_at { Time.now } }
trait(:invited) do
user_id nil
invite_token 'xxx'
user_id { nil }
invite_token { 'xxx' }
sequence :invite_email do |n|
"email#{n}@email.com"
end
end
trait(:ldap) do
ldap true
ldap { true }
end
trait :blocked do
......
......@@ -4,9 +4,9 @@ FactoryBot.define do
factory :group, class: Group, parent: :namespace do
sequence(:name) { |n| "group#{n}" }
path { name.downcase.gsub(/\s/, '_') }
type 'Group'
owner nil
project_creation_level ::Gitlab::Access::MAINTAINER_PROJECT_ACCESS
type { 'Group' }
owner { nil }
project_creation_level { ::Gitlab::Access::MAINTAINER_PROJECT_ACCESS}
after(:create) do |group|
if group.owner
......@@ -17,15 +17,15 @@ FactoryBot.define do
end
trait :public do
visibility_level Gitlab::VisibilityLevel::PUBLIC
visibility_level { Gitlab::VisibilityLevel::PUBLIC}
end
trait :internal do
visibility_level Gitlab::VisibilityLevel::INTERNAL
visibility_level {Gitlab::VisibilityLevel::INTERNAL}
end
trait :private do
visibility_level Gitlab::VisibilityLevel::PRIVATE
visibility_level { Gitlab::VisibilityLevel::PRIVATE}
end
trait :with_avatar do
......@@ -33,7 +33,7 @@ FactoryBot.define do
end
trait :access_requestable do
request_access_enabled true
request_access_enabled { true }
end
trait :nested do
......@@ -41,15 +41,15 @@ FactoryBot.define do
end
trait :auto_devops_enabled do
auto_devops_enabled true
auto_devops_enabled { true }
end
trait :auto_devops_disabled do
auto_devops_enabled false
auto_devops_enabled { false }
end
trait :owner_subgroup_creation_only do
subgroup_creation_level ::Gitlab::Access::OWNER_SUBGROUP_ACCESS
subgroup_creation_level { ::Gitlab::Access::OWNER_SUBGROUP_ACCESS}
end
end
end
......@@ -2,7 +2,7 @@
FactoryBot.define do
factory :identity do
provider 'ldapmain'
extern_uid 'my-ldap-id'
provider { 'ldapmain' }
extern_uid { 'my-ldap-id' }
end
end
......@@ -2,12 +2,12 @@
FactoryBot.define do
factory :import_state, class: ProjectImportState do
status :none
status { :none }
association :project, factory: :project
transient do
import_url { generate(:url) }
import_type nil
import_type { nil }
end
trait :repository do
......@@ -15,23 +15,23 @@ FactoryBot.define do
end
trait :none do
status :none
status { :none }
end
trait :scheduled do
status :scheduled
status { :scheduled }
end
trait :started do
status :started
status { :started }
end
trait :finished do
status :finished
status { :finished }
end
trait :failed do
status :failed
status { :failed }
end
after(:create) do |import_state, evaluator|
......
......@@ -3,7 +3,7 @@
FactoryBot.define do
factory :internal_id do
project
usage :issues
usage { :issues }
last_value { project.issues.maximum(:iid) || 0 }
end
end
......@@ -8,19 +8,19 @@ FactoryBot.define do
updated_by { author }
trait :confidential do
confidential true
confidential { true }
end
trait :opened do
state :opened
state { :opened }
end
trait :locked do
discussion_locked true
discussion_locked { true }
end
trait :closed do
state :closed
state { :closed }
closed_at { Time.now }
end
......@@ -29,7 +29,7 @@ FactoryBot.define do
factory :labeled_issue do
transient do
labels []
labels { [] }
end
after(:create) do |issue, evaluator|
......
......@@ -3,14 +3,14 @@
FactoryBot.define do
trait :base_label do
title { generate(:label_title) }
color "#990000"
color { "#990000" }
end
factory :label, traits: [:base_label], class: ProjectLabel do
project
transient do
priority nil
priority { nil }
end
after(:create) do |label, evaluator|
......
......@@ -4,6 +4,6 @@ FactoryBot.define do
factory :lfs_file_lock do
user
project
path 'README.md'
path { 'README.md' }
end
end
......@@ -5,7 +5,7 @@ include ActionDispatch::TestProcess
FactoryBot.define do
factory :lfs_object do
sequence(:oid) { |n| "b68143e6463773b1b6c6fd009a76c32aeec041faff32ba2ed42fd7f708a%05x" % n }
size 499013
size { 499013 }
end
trait :with_file do
......@@ -15,8 +15,8 @@ FactoryBot.define do
# The uniqueness constraint means we can't use the correct OID for all LFS
# objects, so the test needs to decide which (if any) object gets it
trait :correct_oid do
oid 'b804383982bb89b00e828e3f44c038cc991d3d1768009fc39ba8e2c081b9fb75'
size 1062
oid { 'b804383982bb89b00e828e3f44c038cc991d3d1768009fc39ba8e2c081b9fb75' }
size { 1062 }
end
trait :object_storage do
......
......@@ -4,6 +4,6 @@ FactoryBot.define do
factory :lfs_objects_project do
lfs_object
project
repository_type :project
repository_type { :project }
end
end
......@@ -4,19 +4,19 @@ FactoryBot.define do
factory :list do
board
label
list_type :label
list_type { :label }
sequence(:position)
end
factory :backlog_list, parent: :list do
list_type :backlog
label nil
position nil
list_type { :backlog }
label { nil }
position { nil }
end
factory :closed_list, parent: :list do
list_type :closed
label nil
position nil
list_type { :closed }
label { nil }
position { nil }
end
end
......@@ -4,44 +4,44 @@ FactoryBot.define do
factory :merge_request_diff_file do
association :merge_request_diff
relative_order 0
new_file true
renamed_file false
deleted_file false
too_large false
a_mode 0
b_mode 100644
new_path 'foo'
old_path 'foo'
diff ''
binary false
relative_order { 0 }
new_file { true }
renamed_file { false }
deleted_file { false }
too_large { false }
a_mode { 0 }
b_mode { 100644 }
new_path { 'foo' }
old_path { 'foo' }
diff { '' }
binary { false }
trait :new_file do
relative_order 0
new_file true
renamed_file false
deleted_file false
too_large false
a_mode 0
b_mode 100644
new_path 'foo'
old_path 'foo'
diff ''
binary false
relative_order { 0 }
new_file { true }
renamed_file { false }
deleted_file { false }
too_large { false }
a_mode { 0 }
b_mode { 100644 }
new_path { 'foo' }
old_path { 'foo' }
diff { '' }
binary { false }
end
trait :renamed_file do
relative_order 662
new_file false
renamed_file true
deleted_file false
too_large false
a_mode 100644
b_mode 100644
new_path 'bar'
old_path 'baz'
diff ''
binary false
relative_order { 662 }
new_file { false }
renamed_file { true }
deleted_file { false }
too_large { false }
a_mode { 100644 }
b_mode { 100644 }
new_path { 'bar' }
old_path { 'baz' }
diff { '' }
binary { false }
end
end
end
......@@ -3,8 +3,8 @@
FactoryBot.define do
factory :merge_request_diff do
association :merge_request
state :collected
commits_count 1
state { :collected }
commits_count { 1 }
base_commit_sha { Digest::SHA1.hexdigest(SecureRandom.hex) }
head_commit_sha { Digest::SHA1.hexdigest(SecureRandom.hex) }
......
......@@ -16,36 +16,36 @@ FactoryBot.define do
#
# See also RepoHelpers.sample_compare
#
source_branch "master"
target_branch "feature"
source_branch { "master" }
target_branch { "feature" }
merge_status "can_be_merged"
merge_status { "can_be_merged" }
trait :with_diffs do
end
trait :with_image_diffs do
source_branch "add_images_and_changes"
target_branch "master"
source_branch { "add_images_and_changes" }
target_branch { "master" }
end
trait :without_diffs do
source_branch "improve/awesome"
target_branch "master"
source_branch { "improve/awesome" }
target_branch { "master" }
end
trait :conflict do
source_branch "feature_conflict"
target_branch "feature"
source_branch { "feature_conflict" }
target_branch { "feature" }
end
trait :merged do
state :merged
state { :merged }
end
trait :merged_target do
source_branch "merged-target"
target_branch "improve/awesome"
source_branch { "merged-target" }
target_branch { "improve/awesome" }
end
trait :merged_last_month do
......@@ -57,7 +57,7 @@ FactoryBot.define do
end
trait :closed do
state :closed
state { :closed }
end
trait :closed_last_month do
......@@ -69,36 +69,36 @@ FactoryBot.define do
end
trait :opened do
state :opened
state { :opened }
end
trait :invalid do
source_branch "feature_one"
target_branch "feature_two"
source_branch { "feature_one" }
target_branch { "feature_two" }
end
trait :locked do
state :locked
state { :locked }
end
trait :simple do
source_branch "feature"
target_branch "master"
source_branch { "feature" }
target_branch { "master" }
end
trait :rebased do
source_branch "markdown"
target_branch "improve/awesome"
source_branch { "markdown" }
target_branch { "improve/awesome" }
end
trait :diverged do
source_branch "feature"
target_branch "master"
source_branch { "feature" }
target_branch { "master" }
end
trait :merge_when_pipeline_succeeds do
auto_merge_enabled true
auto_merge_strategy AutoMergeService::STRATEGY_MERGE_WHEN_PIPELINE_SUCCEEDS
auto_merge_enabled { true }
auto_merge_strategy { AutoMergeService::STRATEGY_MERGE_WHEN_PIPELINE_SUCCEEDS }
merge_user { author }
end
......@@ -162,7 +162,7 @@ FactoryBot.define do
end
trait :deployed_review_app do
target_branch 'pages-deploy-target'
target_branch { 'pages-deploy-target' }
transient do
deployment { create(:deployment, :review_app) }
......@@ -203,7 +203,7 @@ FactoryBot.define do
factory :labeled_merge_request do
transient do
labels []
labels { [] }
end
after(:create) do |merge_request, evaluator|
......
......@@ -5,19 +5,19 @@ FactoryBot.define do
title
transient do
project nil
group nil
project_id nil
group_id nil
parent nil
project { nil }
group { nil }
project_id { nil }
group_id { nil }
parent { nil }
end
trait :active do
state "active"
state { "active" }
end
trait :closed do
state "closed"
state { "closed" }
end
trait :with_dates do
......
......@@ -41,14 +41,14 @@ FactoryBot.define do
factory :legacy_diff_note_on_merge_request, traits: [:on_merge_request, :legacy_diff_note], class: LegacyDiffNote do
association :project, :repository
position ''
position { '' }
end
factory :diff_note_on_merge_request, traits: [:on_merge_request], class: DiffNote do
association :project, :repository
transient do
line_number 14
line_number { 14 }
diff_refs { noteable.try(:diff_refs) }
end
......@@ -87,7 +87,7 @@ FactoryBot.define do
association :project, :repository
transient do
line_number 14
line_number { 14 }
diff_refs { project.commit(commit_id).try(:diff_refs) }
end
......@@ -104,14 +104,14 @@ FactoryBot.define do
trait :on_commit do
association :project, :repository
noteable nil
noteable_type 'Commit'
noteable_id nil
noteable { nil }
noteable_type { 'Commit' }
noteable_id { nil }
commit_id { RepoHelpers.sample_commit.id }
end
trait :legacy_diff_note do
line_code "0_184_184"
line_code { "0_184_184" }
end
trait :on_issue do
......@@ -132,19 +132,19 @@ FactoryBot.define do
trait :on_personal_snippet do
noteable { create(:personal_snippet) }
project nil
project { nil }
end
trait :system do
system true
system { true }
end
trait :downvote do
note "thumbsdown"
note { "thumbsdown" }
end
trait :upvote do
note "thumbsup"
note { "thumbsup" }
end
trait :with_attachment do
......@@ -156,7 +156,7 @@ FactoryBot.define do
end
transient do
in_reply_to nil
in_reply_to { nil }
end
before(:create) do |note, evaluator|
......
......@@ -4,6 +4,6 @@ FactoryBot.define do
factory :notification_setting do
source factory: :project
user
level 3
level { 3 }
end
end
......@@ -6,6 +6,6 @@ FactoryBot.define do
uid { Doorkeeper::OAuth::Helpers::UniqueToken.generate }
redirect_uri { generate(:url) }
owner
owner_type 'User'
owner_type { 'User' }
end
end
......@@ -6,7 +6,8 @@ FactoryBot.define do
verified_at { Time.now }
enabled_until { 1.week.from_now }
certificate '-----BEGIN CERTIFICATE-----
certificate do
'-----BEGIN CERTIFICATE-----
MIICGzCCAYSgAwIBAgIBATANBgkqhkiG9w0BAQUFADAbMRkwFwYDVQQDExB0ZXN0
LWNlcnRpZmljYXRlMB4XDTE2MDIxMjE0MzIwMFoXDTIwMDQxMjE0MzIwMFowGzEZ
MBcGA1UEAxMQdGVzdC1jZXJ0aWZpY2F0ZTCBnzANBgkqhkiG9w0BAQEFAAOBjQAw
......@@ -20,8 +21,10 @@ joZp2JHYvNlTPkRJ/J4TcXxBTJmArcQgTIuNoBtC+0A/SwdK4MfTCUY4vNWNdese
5A4K65Nb7Oh1AdQieTBHNXXCdyFsva9/ScfQGEl7p55a52jOPs0StPd7g64uvjlg
YHi2yesCrOvVXt+lgPTd
-----END CERTIFICATE-----'
end
key '-----BEGIN PRIVATE KEY-----
key do
'-----BEGIN PRIVATE KEY-----
MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAKS+CfS9GcRSdYSN
SzyH5QJQBr5umRL6E+KilOV39iYFO/9oHjUdapTRWkrwnNPCp7qaeck4Jr8iv14t
PVNDfNr76eGb6/3YknOAP0QOjLWunoC8kjU+N/JHU52NrUeX3qEy8EKV9LeCDJcB
......@@ -37,10 +40,11 @@ EPjGlXIT+aW2XiPmK3ZlCDcWIenE+lmtbOpI159Wpk8BGXs/s/xBAkEAlAY3ymgx
63BDJEwvOb2IaP8lDDxNsXx9XJNVvQbv5n15vNsLHbjslHfAhAbxnLQ1fLhUPqSi
nNp/xedE1YxutQ==
-----END PRIVATE KEY-----'
end
trait :disabled do
verified_at nil
enabled_until nil
verified_at { nil }
enabled_until { nil }
end
trait :scheduled_for_removal do
......@@ -52,7 +56,7 @@ nNp/xedE1YxutQ==
end
trait :unverified do
verified_at nil
verified_at { nil }
end
trait :reverify do
......@@ -64,17 +68,18 @@ nNp/xedE1YxutQ==
end
trait :without_certificate do
certificate nil
certificate { nil }
end
trait :without_key do
key nil
key { nil }
end
trait :with_missing_chain do
# This certificate is signed with different key
# And misses the CA to build trust chain
certificate '-----BEGIN CERTIFICATE-----
certificate do
'-----BEGIN CERTIFICATE-----
MIIDGTCCAgGgAwIBAgIBAjANBgkqhkiG9w0BAQUFADASMRAwDgYDVQQDEwdUZXN0
IENBMB4XDTE2MDIxMjE0MjMwMFoXDTE3MDIxMTE0MjMwMFowHTEbMBkGA1UEAxMS
dGVzdC1jZXJ0aWZpY2F0ZS0yMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKC
......@@ -93,13 +98,15 @@ WlU8raZoPIqf6H/8JA97pM/nk/3CqCoHsouSQv+jGY4pSL22RqsO0ylIM0LDBbmF
m4AEaojTljX1tMJAF9Rbiw/omam5bDPq2JWtosrz/zB69y5FaQjc6FnCk0M4oN/+
VM+d42lQAgoq318A84Xu5vRh1KCAJuztkhNbM+w=
-----END CERTIFICATE-----'
end
end
trait :with_trusted_chain do
# This contains
# [Intermediate #2 (SHA-2)] 'Comodo RSA Domain Validation Secure Server CA'
# [Intermediate #1 (SHA-2)] 'COMODO RSA Certification Authority'
certificate '-----BEGIN CERTIFICATE-----
certificate do
'-----BEGIN CERTIFICATE-----
MIIGCDCCA/CgAwIBAgIQKy5u6tl1NmwUim7bo3yMBzANBgkqhkiG9w0BAQwFADCB
hTELMAkGA1UEBhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4G
A1UEBxMHU2FsZm9yZDEaMBgGA1UEChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNV
......@@ -166,13 +173,15 @@ B5a6SE2Q8pTIqXOi6wZ7I53eovNNVZ96YUWYGGjHXkBrI/V5eu+MtWuLt29G9Hvx
PUsE2JOAWVrgQSQdso8VYFhH2+9uRv0V9dlfmrPb2LjkQLPNlzmuhbsdjrzch5vR
pu/xO28QOG8=
-----END CERTIFICATE-----'
end
end
trait :with_trusted_expired_chain do
# This contains
# Let's Encrypt Authority X3
# DST Root CA X3
certificate '-----BEGIN CERTIFICATE-----
certificate do
'-----BEGIN CERTIFICATE-----
MIIFSjCCBDKgAwIBAgISAw24xGWrFotvTBa6AZI/pzq1MA0GCSqGSIb3DQEBCwUA
MEoxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MSMwIQYDVQQD
ExpMZXQncyBFbmNyeXB0IEF1dGhvcml0eSBYMzAeFw0xOTAzMDcxNzU5NTZaFw0x
......@@ -250,10 +259,12 @@ R8srzJmwN0jP41ZL9c8PDHIyh8bwRLtTcm1D9SZImlJnt1ir/md2cXjbDaJWFBM5
JDGFoqgCWjBH4d1QB7wCCZAA62RjYJsWvIjJEubSfZGL+T0yjWW06XyxV3bqxbYo
Ob8VZRzI9neWagqNdwvYkQsEjgfbKbYK7p2CNTUQ
-----END CERTIFICATE-----'
end
end
trait :with_expired_certificate do
certificate '-----BEGIN CERTIFICATE-----
certificate do
'-----BEGIN CERTIFICATE-----
MIIBsDCCARmgAwIBAgIBATANBgkqhkiG9w0BAQUFADAeMRwwGgYDVQQDExNleHBp
cmVkLWNlcnRpZmljYXRlMB4XDTE1MDIxMjE0MzMwMFoXDTE2MDIwMTE0MzMwMFow
HjEcMBoGA1UEAxMTZXhwaXJlZC1jZXJ0aWZpY2F0ZTCBnzANBgkqhkiG9w0BAQEF
......@@ -265,6 +276,7 @@ Hq9LkWn6WP4EHsesHyslgTQZF8C7kVLTbLn2noLnOE+Mp3vcWlZxl3Yk6aZMhKS+
Iy6oRpHaCF/2obZdIdgf9rlyz0fkqyHJc9GkioSoOhJZxEV2SgAkap8yS0sX2tJ9
ZDXgrA==
-----END CERTIFICATE-----'
end
end
trait :letsencrypt do
......@@ -273,7 +285,8 @@ ZDXgrA==
end
trait :explicit_ecdsa do
certificate '-----BEGIN CERTIFICATE-----
certificate do
'-----BEGIN CERTIFICATE-----
MIID1zCCAzkCCQDatOIwBlktwjAKBggqhkjOPQQDAjBPMQswCQYDVQQGEwJVUzEL
MAkGA1UECAwCTlkxCzAJBgNVBAcMAk5ZMQswCQYDVQQLDAJJVDEZMBcGA1UEAwwQ
dGVzdC1jZXJ0aWZpY2F0ZTAeFw0xOTA4MjkxMTE1NDBaFw0yMTA4MjgxMTE1NDBa
......@@ -296,8 +309,10 @@ OjSJpIDdFWGVYJHyMDI5WgQyhm4hAioXJ0T22Zab8Wmq+hBYRJNcHoaV894blfqR
V3ZJgam8EQJCAcnPpJQ0IqoT1pAQkaL3+Ka8ZaaCd6/8RnoDtGvWljisuyH65SRu
kmYv87bZe1KqOZDoaDBdfVsoxcGbik19lBPV
-----END CERTIFICATE-----'
end
key '-----BEGIN EC PARAMETERS-----
key do
'-----BEGIN EC PARAMETERS-----
MIIBwgIBATBNBgcqhkjOPQEBAkIB////////////////////////////////////
//////////////////////////////////////////////////8wgZ4EQgH/////
////////////////////////////////////////////////////////////////
......@@ -326,10 +341,12 @@ ZAkCAQGhgYkDgYYABAFUb/hz+GCXfq2geP54Yvimq/uXsz5kpAni/PRj0TrEjH6C
+Iu6YSMSWFwExlVeJeFvm3F/XW5cBafmfpCF7Llgo8w2MsuoOpobX158IsJ3bUDR
Nw==
-----END EC PRIVATE KEY-----'
end
end
trait :ecdsa do
certificate '-----BEGIN CERTIFICATE-----
certificate do
'-----BEGIN CERTIFICATE-----
MIIB8zCCAVUCCQCGKuPQ6SBxUTAKBggqhkjOPQQDAjA+MQswCQYDVQQGEwJVUzEL
MAkGA1UECAwCVVMxCzAJBgNVBAcMAlVTMRUwEwYDVQQDDAxzaHVzaGxpbi5kZXYw
HhcNMTkwOTAyMDkyMDUxWhcNMjEwOTAxMDkyMDUxWjA+MQswCQYDVQQGEwJVUzEL
......@@ -342,8 +359,10 @@ R9WYUg5+PQMg7kS+4K/5+5gonWCvaMcP+2P7hltUcvq41l3uMKKCZRU/x60/FMHc
1ZXdAkIBuVtm9RJXziNOKS4TcpH9os/FuREW8YQlpec58LDZdlivcHnikHZ4LCri
T7zu3VY6Rq+V/IKpsQwQjmoTJ0IpCM8=
-----END CERTIFICATE-----'
end
key '-----BEGIN EC PARAMETERS-----
key do
'-----BEGIN EC PARAMETERS-----
BgUrgQQAIw==
-----END EC PARAMETERS-----
-----BEGIN EC PRIVATE KEY-----
......@@ -353,6 +372,7 @@ dNqyCW1lFsgyt6KHJw6H8bhNemSny1O0Sy4P6yHxq7cnLCyLz1FJnq+BWgJjv/8N
Da9qZifIFmpsv5xNAGxDvANQRpLI/RHc/hvo7HfjuljNfBJ1I6tr0KbhMxB76mtU
x6zG6WoibsbsJMj70nwseUnPTBQNDP+j61RJjC/r
-----END EC PRIVATE KEY-----'
end
end
end
end
......@@ -4,19 +4,19 @@ FactoryBot.define do
factory :personal_access_token do
user
sequence(:name) { |n| "PAT #{n}" }
revoked false
revoked { false }
expires_at { 5.days.from_now }
scopes ['api']
impersonation false
scopes { ['api'] }
impersonation { false }
after(:build) { |personal_access_token| personal_access_token.ensure_token }
trait :impersonation do
impersonation true
impersonation { true }
end
trait :revoked do
revoked true
revoked { true }
end
trait :expired do
......@@ -24,7 +24,7 @@ FactoryBot.define do
end
trait :invalid do
token_digest nil
token_digest { nil }
end
end
end
......@@ -3,7 +3,7 @@
FactoryBot.define do
factory :pool_repository do
shard { Shard.by_name("default") }
state :none
state { :none }
before(:create) do |pool|
pool.source_project = create(:project, :repository)
......@@ -11,19 +11,19 @@ FactoryBot.define do
end
trait :scheduled do
state :scheduled
state { :scheduled }
end
trait :failed do
state :failed
state { :failed }
end
trait :obsolete do
state :obsolete
state { :obsolete }
end
trait :ready do
state :ready
state { :ready }
after(:create) do |pool|
pool.create_object_pool
......
......@@ -2,7 +2,7 @@
FactoryBot.define do
factory :programming_language do
name 'Ruby'
color '#123456'
name { 'Ruby' }
color { '#123456' }
end
end
......@@ -3,23 +3,23 @@
FactoryBot.define do
factory :project_auto_devops do
project
enabled true
deploy_strategy :continuous
enabled { true }
deploy_strategy { :continuous }
trait :continuous_deployment do
deploy_strategy ProjectAutoDevops.deploy_strategies[:continuous] # rubocop:disable FactoryBot/DynamicAttributeDefinedStatically
deploy_strategy { ProjectAutoDevops.deploy_strategies[:continuous] }
end
trait :manual_deployment do
deploy_strategy ProjectAutoDevops.deploy_strategies[:manual] # rubocop:disable FactoryBot/DynamicAttributeDefinedStatically
deploy_strategy { ProjectAutoDevops.deploy_strategies[:manual] }
end
trait :timed_incremental_deployment do
deploy_strategy ProjectAutoDevops.deploy_strategies[:timed_incremental] # rubocop:disable FactoryBot/DynamicAttributeDefinedStatically
deploy_strategy { ProjectAutoDevops.deploy_strategies[:timed_incremental] }
end
trait :disabled do
enabled false
enabled { false }
end
end
end
......@@ -3,6 +3,6 @@
FactoryBot.define do
factory :project_daily_statistic do
project
fetch_count 1
fetch_count { 1 }
end
end
......@@ -3,10 +3,10 @@
FactoryBot.define do
factory :project_error_tracking_setting, class: ErrorTracking::ProjectErrorTrackingSetting do
project
api_url 'https://gitlab.com/api/0/projects/sentry-org/sentry-project'
enabled true
token 'access_token_123'
project_name 'Sentry Project'
organization_name 'Sentry Org'
api_url { 'https://gitlab.com/api/0/projects/sentry-org/sentry-project' }
enabled { true }
token { 'access_token_123' }
project_name { 'Sentry Project' }
organization_name { 'Sentry Org' }
end
end
......@@ -4,6 +4,6 @@ FactoryBot.define do
factory :project_group_link do
project
group
expires_at nil
expires_at { nil }
end
end
......@@ -3,7 +3,7 @@
FactoryBot.define do
factory :project_hook do
url { generate(:url) }
enable_ssl_verification false
enable_ssl_verification { false }
project
trait :token do
......@@ -11,16 +11,16 @@ FactoryBot.define do
end
trait :all_events_enabled do
push_events true
merge_requests_events true
tag_push_events true
issues_events true
confidential_issues_events true
note_events true
confidential_note_events true
job_events true
pipeline_events true
wiki_page_events true
push_events { true }
merge_requests_events { true }
tag_push_events { true }
issues_events { true }
confidential_issues_events { true }
note_events { true }
confidential_note_events { true }
job_events { true }
pipeline_events { true }
wiki_page_events { true }
end
end
end
......@@ -6,16 +6,16 @@ FactoryBot.define do
project
maintainer
trait(:guest) { access_level ProjectMember::GUEST }
trait(:reporter) { access_level ProjectMember::REPORTER }
trait(:developer) { access_level ProjectMember::DEVELOPER }
trait(:maintainer) { access_level ProjectMember::MAINTAINER }
trait(:guest) { access_level { ProjectMember::GUEST } }
trait(:reporter) { access_level { ProjectMember::REPORTER } }
trait(:developer) { access_level { ProjectMember::DEVELOPER } }
trait(:maintainer) { access_level { ProjectMember::MAINTAINER } }
trait(:access_request) { requested_at { Time.now } }
trait(:invited) do
user_id nil
invite_token 'xxx'
invite_email 'email@email.com'
user_id { nil }
invite_token { 'xxx' }
invite_email { 'email@email.com' }
end
trait :blocked do
......
......@@ -3,6 +3,6 @@
FactoryBot.define do
factory :project_metrics_setting, class: ProjectMetricsSetting do
project
external_dashboard_url 'https://grafana.com'
external_dashboard_url { 'https://grafana.com' }
end
end
......@@ -13,7 +13,7 @@ FactoryBot.define do
sequence(:name) { |n| "project#{n}" }
path { name.downcase.gsub(/\s/, '_') }
# Behaves differently to nil due to cache_has_external_issue_tracker
has_external_issue_tracker false
has_external_issue_tracker { false }
# Associations
namespace
......@@ -21,21 +21,21 @@ FactoryBot.define do
transient do
# Nest Project Feature attributes
wiki_access_level ProjectFeature::ENABLED
builds_access_level ProjectFeature::ENABLED
snippets_access_level ProjectFeature::ENABLED
issues_access_level ProjectFeature::ENABLED
merge_requests_access_level ProjectFeature::ENABLED
repository_access_level ProjectFeature::ENABLED
wiki_access_level { ProjectFeature::ENABLED }
builds_access_level { ProjectFeature::ENABLED }
snippets_access_level { ProjectFeature::ENABLED }
issues_access_level { ProjectFeature::ENABLED }
merge_requests_access_level { ProjectFeature::ENABLED }
repository_access_level { ProjectFeature::ENABLED }
pages_access_level do
visibility_level == Gitlab::VisibilityLevel::PUBLIC ? ProjectFeature::ENABLED : ProjectFeature::PRIVATE
end
# we can't assign the delegated `#ci_cd_settings` attributes directly, as the
# `#ci_cd_settings` relation needs to be created first
group_runners_enabled nil
import_status nil
import_jid nil
group_runners_enabled { nil }
import_status { nil }
import_jid { nil }
end
after(:create) do |project, evaluator|
......@@ -80,45 +80,45 @@ FactoryBot.define do
end
trait :public do
visibility_level Gitlab::VisibilityLevel::PUBLIC
visibility_level { Gitlab::VisibilityLevel::PUBLIC }
end
trait :internal do
visibility_level Gitlab::VisibilityLevel::INTERNAL
visibility_level { Gitlab::VisibilityLevel::INTERNAL }
end
trait :private do
visibility_level Gitlab::VisibilityLevel::PRIVATE
visibility_level { Gitlab::VisibilityLevel::PRIVATE }
end
trait :import_scheduled do
import_status :scheduled
import_status { :scheduled }
end
trait :import_started do
import_status :started
import_status { :started }
end
trait :import_finished do
import_status :finished
import_status { :finished }
end
trait :import_failed do
import_status :failed
import_status { :failed }
end
trait :archived do
archived true
archived { true }
end
storage_version Project::LATEST_STORAGE_VERSION
storage_version { Project::LATEST_STORAGE_VERSION }
trait :legacy_storage do
storage_version nil
storage_version { nil }
end
trait :access_requestable do
request_access_enabled true
request_access_enabled { true }
end
trait :with_avatar do
......@@ -146,7 +146,7 @@ FactoryBot.define do
# will create a repository containing two files, and two commits, in master
trait :custom_repo do
transient do
files {}
files { {} }
end
after :create do |project, evaluator|
......@@ -169,7 +169,7 @@ FactoryBot.define do
test_repo
transient do
create_templates nil
create_templates { nil }
end
after :create do |project, evaluator|
......@@ -206,9 +206,9 @@ FactoryBot.define do
trait :remote_mirror do
transient do
remote_name "remote_mirror_#{SecureRandom.hex}"
url "http://foo.com"
enabled true
remote_name { "remote_mirror_#{SecureRandom.hex}" }
url { "http://foo.com" }
enabled { true }
end
after(:create) do |project, evaluator|
project.remote_mirrors.create!(url: evaluator.url, enabled: evaluator.enabled)
......@@ -229,7 +229,7 @@ FactoryBot.define do
end
trait :read_only do
repository_read_only true
repository_read_only { true }
end
trait :broken_repo do
......@@ -249,29 +249,29 @@ FactoryBot.define do
end
end
trait(:wiki_enabled) { wiki_access_level ProjectFeature::ENABLED }
trait(:wiki_disabled) { wiki_access_level ProjectFeature::DISABLED }
trait(:wiki_private) { wiki_access_level ProjectFeature::PRIVATE }
trait(:builds_enabled) { builds_access_level ProjectFeature::ENABLED }
trait(:builds_disabled) { builds_access_level ProjectFeature::DISABLED }
trait(:builds_private) { builds_access_level ProjectFeature::PRIVATE }
trait(:snippets_enabled) { snippets_access_level ProjectFeature::ENABLED }
trait(:snippets_disabled) { snippets_access_level ProjectFeature::DISABLED }
trait(:snippets_private) { snippets_access_level ProjectFeature::PRIVATE }
trait(:issues_disabled) { issues_access_level ProjectFeature::DISABLED }
trait(:issues_enabled) { issues_access_level ProjectFeature::ENABLED }
trait(:issues_private) { issues_access_level ProjectFeature::PRIVATE }
trait(:merge_requests_enabled) { merge_requests_access_level ProjectFeature::ENABLED }
trait(:merge_requests_disabled) { merge_requests_access_level ProjectFeature::DISABLED }
trait(:merge_requests_private) { merge_requests_access_level ProjectFeature::PRIVATE }
trait(:merge_requests_public) { merge_requests_access_level ProjectFeature::PUBLIC }
trait(:repository_enabled) { repository_access_level ProjectFeature::ENABLED }
trait(:repository_disabled) { repository_access_level ProjectFeature::DISABLED }
trait(:repository_private) { repository_access_level ProjectFeature::PRIVATE }
trait(:pages_public) { pages_access_level ProjectFeature::PUBLIC }
trait(:pages_enabled) { pages_access_level ProjectFeature::ENABLED }
trait(:pages_disabled) { pages_access_level ProjectFeature::DISABLED }
trait(:pages_private) { pages_access_level ProjectFeature::PRIVATE }
trait(:wiki_enabled) { wiki_access_level { ProjectFeature::ENABLED } }
trait(:wiki_disabled) { wiki_access_level { ProjectFeature::DISABLED } }
trait(:wiki_private) { wiki_access_level { ProjectFeature::PRIVATE } }
trait(:builds_enabled) { builds_access_level { ProjectFeature::ENABLED } }
trait(:builds_disabled) { builds_access_level { ProjectFeature::DISABLED } }
trait(:builds_private) { builds_access_level { ProjectFeature::PRIVATE } }
trait(:snippets_enabled) { snippets_access_level { ProjectFeature::ENABLED } }
trait(:snippets_disabled) { snippets_access_level { ProjectFeature::DISABLED } }
trait(:snippets_private) { snippets_access_level { ProjectFeature::PRIVATE } }
trait(:issues_disabled) { issues_access_level { ProjectFeature::DISABLED } }
trait(:issues_enabled) { issues_access_level { ProjectFeature::ENABLED } }
trait(:issues_private) { issues_access_level { ProjectFeature::PRIVATE } }
trait(:merge_requests_enabled) { merge_requests_access_level { ProjectFeature::ENABLED } }
trait(:merge_requests_disabled) { merge_requests_access_level { ProjectFeature::DISABLED } }
trait(:merge_requests_private) { merge_requests_access_level { ProjectFeature::PRIVATE } }
trait(:merge_requests_public) { merge_requests_access_level { ProjectFeature::PUBLIC } }
trait(:repository_enabled) { repository_access_level { ProjectFeature::ENABLED } }
trait(:repository_disabled) { repository_access_level { ProjectFeature::DISABLED } }
trait(:repository_private) { repository_access_level { ProjectFeature::PRIVATE } }
trait(:pages_public) { pages_access_level { ProjectFeature::PUBLIC } }
trait(:pages_enabled) { pages_access_level { ProjectFeature::ENABLED } }
trait(:pages_disabled) { pages_access_level { ProjectFeature::DISABLED } }
trait(:pages_private) { pages_access_level { ProjectFeature::PRIVATE } }
trait :auto_devops do
association :auto_devops, factory: :project_auto_devops
......@@ -308,19 +308,19 @@ FactoryBot.define do
end
factory :redmine_project, parent: :project do
has_external_issue_tracker true
has_external_issue_tracker { true }
redmine_service
end
factory :youtrack_project, parent: :project do
has_external_issue_tracker true
has_external_issue_tracker { true }
youtrack_service
end
factory :jira_project, parent: :project do
has_external_issue_tracker true
has_external_issue_tracker { true }
jira_service
end
......
......@@ -2,17 +2,17 @@
FactoryBot.define do
factory :prometheus_metric, class: PrometheusMetric do
title 'title'
query 'avg(metric)'
y_label 'y_label'
unit 'm/s'
group :business
title { 'title' }
query { 'avg(metric)' }
y_label { 'y_label' }
unit { 'm/s' }
group { :business }
project
legend 'legend'
legend { 'legend' }
trait :common do
common true
project nil
common { true }
project { nil }
end
end
end
......@@ -6,14 +6,14 @@ FactoryBot.define do
project
transient do
default_push_level true
default_merge_level true
default_access_level true
default_push_level { true }
default_merge_level { true }
default_access_level { true }
end
trait :developers_can_push do
transient do
default_push_level false
default_push_level { false }
end
after(:build) do |protected_branch|
......@@ -23,7 +23,7 @@ FactoryBot.define do
trait :developers_can_merge do
transient do
default_merge_level false
default_merge_level { false }
end
after(:build) do |protected_branch|
......@@ -33,7 +33,7 @@ FactoryBot.define do
trait :no_one_can_push do
transient do
default_push_level false
default_push_level { false }
end
after(:build) do |protected_branch|
......@@ -43,7 +43,7 @@ FactoryBot.define do
trait :maintainers_can_push do
transient do
default_push_level false
default_push_level { false }
end
after(:build) do |protected_branch|
......
......@@ -6,12 +6,12 @@ FactoryBot.define do
project
transient do
default_access_level true
default_access_level { true }
end
trait :developers_can_create do
transient do
default_access_level false
default_access_level { false }
end
after(:build) do |protected_tag|
......@@ -21,7 +21,7 @@ FactoryBot.define do
trait :no_one_can_create do
transient do
default_access_level false
default_access_level { false }
end
after(:build) do |protected_tag|
......@@ -31,7 +31,7 @@ FactoryBot.define do
trait :maintainers_can_create do
transient do
default_access_level false
default_access_level { false }
end
after(:build) do |protected_tag|
......
......@@ -2,17 +2,17 @@
FactoryBot.define do
factory :release do
tag "v1.1.0"
sha 'b83d6e391c22777fca1ed3012fce84f633d7fed0'
tag { "v1.1.0" }
sha { 'b83d6e391c22777fca1ed3012fce84f633d7fed0' }
name { tag }
description "Awesome release"
description { "Awesome release" }
project
author
released_at { Time.zone.parse('2018-10-20T18:00:00Z') }
trait :legacy do
sha nil
author nil
sha { nil }
author { nil }
end
end
end
......@@ -3,6 +3,6 @@
FactoryBot.define do
factory :remote_mirror, class: 'RemoteMirror' do
association :project, :repository
url "http://foo:bar@test.com"
url { "http://foo:bar@test.com" }
end
end
......@@ -4,6 +4,6 @@ FactoryBot.define do
factory :repository_language do
project
programming_language
share 98.5
share { 98.5 }
end
end
......@@ -2,7 +2,7 @@
FactoryBot.define do
factory :resource_label_event do
action :add
action { :add }
label
user { issuable&.author || create(:user) }
......
......@@ -3,54 +3,58 @@
FactoryBot.define do
factory :service do
project
type 'Service'
type { 'Service' }
end
factory :custom_issue_tracker_service, class: CustomIssueTrackerService do
project
active true
active { true }
issue_tracker
end
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
)
type { 'EmailsOnPushService' }
active { true }
push_events { true }
tag_push_events { true }
properties do
{
recipients: 'test@example.com',
disable_diffs: true,
send_from_committer_email: true
}
end
end
factory :mock_deployment_service do
project
type 'MockDeploymentService'
active true
type { 'MockDeploymentService' }
active { true }
end
factory :prometheus_service do
project
active true
properties({
api_url: 'https://prometheus.example.com/',
manual_configuration: true
})
active { true }
properties do
{
api_url: 'https://prometheus.example.com/',
manual_configuration: true
}
end
end
factory :jira_service do
project
active true
active { true }
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'
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|
......@@ -65,34 +69,34 @@ FactoryBot.define do
factory :bugzilla_service do
project
active true
active { true }
issue_tracker
end
factory :redmine_service do
project
active true
active { true }
issue_tracker
end
factory :youtrack_service do
project
active true
active { true }
issue_tracker
end
factory :gitlab_issue_tracker_service do
project
active true
active { true }
issue_tracker
end
trait :issue_tracker do
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'
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|
......@@ -105,29 +109,29 @@ FactoryBot.define do
end
trait :jira_cloud_service do
url 'https://mysite.atlassian.net'
username 'jira_user'
password 'my-secret-password'
url { 'https://mysite.atlassian.net' }
username { 'jira_user' }
password { 'my-secret-password' }
end
factory :hipchat_service do
project
type 'HipchatService'
token 'test_token'
type { 'HipchatService' }
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/issues/29404
trait :without_properties_callback do
jira_tracker_data nil
issue_tracker_data nil
create_data false
jira_tracker_data { nil }
issue_tracker_data { nil }
create_data { false }
after(:build) do |service|
IssueTrackerService.skip_callback(:validation, :before, :handle_properties)
end
to_create { |instance| instance.save(validate: false)}
to_create { |instance| instance.save(validate: false) }
after(:create) do
IssueTrackerService.set_callback(:validation, :before, :handle_properties)
......
......@@ -2,6 +2,6 @@
FactoryBot.define do
factory :shard do
name "default"
name { "default" }
end
end
......@@ -9,15 +9,15 @@ FactoryBot.define do
file_name { generate(:filename) }
trait :public do
visibility_level Snippet::PUBLIC
visibility_level { Snippet::PUBLIC }
end
trait :internal do
visibility_level Snippet::INTERNAL
visibility_level { Snippet::INTERNAL }
end
trait :private do
visibility_level Snippet::PRIVATE
visibility_level { Snippet::PRIVATE }
end
end
......
......@@ -4,7 +4,7 @@ FactoryBot.define do
factory :spam_log do
user
sequence(:source_ip) { |n| "42.42.42.#{n % 255}" }
noteable_type 'Issue'
noteable_type { 'Issue' }
sequence(:title) { |n| "Spam title #{n}" }
description { "Spam description\nwith\nmultiple\nlines" }
end
......
......@@ -2,18 +2,18 @@
FactoryBot.define do
factory :suggestion do
relative_order 0
relative_order { 0 }
association :note, factory: :diff_note_on_merge_request
from_content " vars = {\n"
to_content " vars = [\n"
from_content { " vars = {\n" }
to_content { " vars = [\n" }
trait :unappliable do
from_content "foo"
to_content "foo"
from_content { "foo" }
to_content { "foo" }
end
trait :applied do
applied true
applied { true }
commit_id { RepoHelpers.sample_commit.id }
end
......
......@@ -3,6 +3,6 @@
FactoryBot.define do
factory :system_note_metadata do
note
action 'merge'
action { 'merge' }
end
end
......@@ -7,10 +7,10 @@ FactoryBot.define do
end
trait :declined do
accepted false
accepted { false }
end
trait :accepted do
accepted true
accepted { true }
end
end
......@@ -2,6 +2,6 @@
FactoryBot.define do
factory :term, class: ApplicationSetting::Term do
terms "Lorem ipsum dolor sit amet, consectetur adipiscing elit."
terms { "Lorem ipsum dolor sit amet, consectetur adipiscing elit." }
end
end
......@@ -4,7 +4,7 @@
FactoryBot.define do
factory :timelog do
time_spent 3600
time_spent { 3600 }
issue
user { issue.project.creator }
end
......
......@@ -38,11 +38,11 @@ FactoryBot.define do
end
trait :pending do
state :pending
state { :pending }
end
trait :done do
state :done
state { :done }
end
end
......@@ -52,6 +52,6 @@ FactoryBot.define do
user
action { Todo::ASSIGNED }
commit_id { RepoHelpers.sample_commit.id }
target_type "Commit"
target_type { "Commit" }
end
end
......@@ -5,6 +5,6 @@ FactoryBot.define do
certificate { FFaker::BaconIpsum.characters(728) }
key_handle { FFaker::BaconIpsum.characters(86) }
public_key { FFaker::BaconIpsum.characters(88) }
counter 0
counter { 0 }
end
end
......@@ -4,28 +4,28 @@ FactoryBot.define do
factory :upload do
model { build(:project) }
size { 100.kilobytes }
uploader "AvatarUploader"
mount_point :avatar
secret nil
store ObjectStorage::Store::LOCAL
uploader { "AvatarUploader" }
mount_point { :avatar }
secret { nil }
store { ObjectStorage::Store::LOCAL }
# we should build a mount agnostic upload by default
transient do
filename 'myfile.jpg'
filename { 'myfile.jpg' }
end
# this needs to comply with RecordsUpload::Concern#upload_path
path { File.join("uploads/-/system", model.class.underscore, mount_point.to_s, 'avatar.jpg') }
trait :personal_snippet_upload do
uploader "PersonalFileUploader"
uploader { "PersonalFileUploader" }
path { File.join(secret, filename) }
model { build(:personal_snippet) }
secret { SecureRandom.hex }
end
trait :issuable_upload do
uploader "FileUploader"
uploader { "FileUploader" }
path { File.join(secret, filename) }
secret { SecureRandom.hex }
end
......@@ -38,27 +38,27 @@ FactoryBot.define do
end
trait :object_storage do
store ObjectStorage::Store::REMOTE
store { ObjectStorage::Store::REMOTE }
end
trait :namespace_upload do
model { build(:group) }
path { File.join(secret, filename) }
uploader "NamespaceFileUploader"
uploader { "NamespaceFileUploader" }
secret { SecureRandom.hex }
end
trait :favicon_upload do
model { build(:appearance) }
path { File.join(secret, filename) }
uploader "FaviconUploader"
uploader { "FaviconUploader" }
secret { SecureRandom.hex }
end
trait :attachment_upload do
mount_point :attachment
mount_point { :attachment }
model { build(:note) }
uploader "AttachmentUploader"
uploader { "AttachmentUploader" }
end
end
end
......@@ -2,8 +2,8 @@
FactoryBot.define do
factory :user_agent_detail do
ip_address '127.0.0.1'
user_agent 'AppleWebKit/537.36'
ip_address { '127.0.0.1' }
user_agent { 'AppleWebKit/537.36' }
association :subject, factory: :issue
end
end
......@@ -2,7 +2,7 @@
FactoryBot.define do
factory :user_callout do
feature_name :gke_cluster_integration
feature_name { :gke_cluster_integration }
user
end
......
......@@ -3,7 +3,7 @@
FactoryBot.define do
factory :user_status do
user
emoji 'coffee'
message 'I crave coffee'
emoji { 'coffee' }
message { 'I crave coffee' }
end
end
......@@ -5,17 +5,17 @@ FactoryBot.define do
email { generate(:email) }
name { generate(:name) }
username { generate(:username) }
password "12345678"
password { "12345678" }
confirmed_at { Time.now }
confirmation_token { nil }
can_create_group true
can_create_group { true }
after(:stub) do |user|
user.notification_email = user.email
end
trait :admin do
admin true
admin { true }
end
trait :blocked do
......@@ -23,7 +23,7 @@ FactoryBot.define do
end
trait :external do
external true
external { true }
end
trait :two_factor do
......@@ -31,7 +31,7 @@ FactoryBot.define do
end
trait :ghost do
ghost true
ghost { true }
after(:build) { |user, _| user.block! }
end
......@@ -40,11 +40,11 @@ FactoryBot.define do
end
trait :with_sign_ins do
sign_in_count 3
sign_in_count { 3 }
current_sign_in_at { Time.now }
last_sign_in_at { FFaker::Time.between(10.days.ago, 1.day.ago) }
current_sign_in_ip '127.0.0.1'
last_sign_in_ip '127.0.0.1'
current_sign_in_ip { '127.0.0.1' }
last_sign_in_ip { '127.0.0.1' }
end
trait :two_factor_via_otp do
......@@ -57,7 +57,7 @@ FactoryBot.define do
end
trait :two_factor_via_u2f do
transient { registrations_count 5 }
transient { registrations_count { 5 } }
after(:create) do |user, evaluator|
create_list(:u2f_registration, evaluator.registrations_count, user: user)
......@@ -65,7 +65,7 @@ FactoryBot.define do
end
trait :readme do
project_view :readme
project_view { :readme }
end
trait :commit_email do
......@@ -77,7 +77,7 @@ FactoryBot.define do
end
transient do
developer_projects []
developer_projects { [] }
end
after(:create) do |user, evaluator|
......@@ -88,8 +88,8 @@ FactoryBot.define do
factory :omniauth_user do
transient do
extern_uid '123456'
provider 'ldapmain'
extern_uid { '123456' }
provider { 'ldapmain' }
end
after(:create) do |user, evaluator|
......
......@@ -3,14 +3,20 @@
FactoryBot.define do
factory :web_hook_log do
web_hook factory: :project_hook
trigger 'push_hooks'
trigger { 'push_hooks' }
url { generate(:url) }
request_headers {}
request_data {}
response_headers {}
response_body ''
response_status '200'
execution_duration 2.0
internal_error_message nil
request_headers do
{}
end
request_data do
{}
end
response_headers do
{}
end
response_body { '' }
response_status { '200' }
execution_duration { 2.0 }
internal_error_message { nil }
end
end
......@@ -4,7 +4,7 @@ FactoryBot.define do
factory :wiki_directory do
skip_create
slug '/path_up_to/dir'
slug { '/path_up_to/dir' }
initialize_with { new(slug) }
end
end
require 'spec_helper'
describe GitlabSchema.types['ExtendedIssue'] do
it { expect(described_class).to expose_permissions_using(Types::PermissionTypes::Issue) }
it { expect(described_class.graphql_name).to eq('ExtendedIssue') }
it { expect(described_class).to require_graphql_authorizations(:read_issue) }
it { expect(described_class.interfaces).to include(Types::Notes::NoteableType.to_graphql) }
it 'has specific fields' do
fields = Types::IssueType.fields.keys + [:subscribed]
fields.each do |field_name|
expect(described_class).to have_graphql_field(field_name)
end
end
end
......@@ -10,8 +10,9 @@ describe GitlabSchema.types['Issue'] do
it { expect(described_class.interfaces).to include(Types::Notes::NoteableType.to_graphql) }
it 'has specific fields' do
fields = %i[title_html description_html relative_position web_path web_url
reference]
fields = %i[iid title description state reference author assignees participants labels epic milestone due_date
confidential discussion_locked upvotes downvotes user_notes_count web_path web_url relative_position
time_estimate total_time_spent closed_at created_at updated_at task_completion_status]
fields.each do |field_name|
expect(described_class).to have_graphql_field(field_name)
......
......@@ -25,4 +25,22 @@ describe GitlabSchema.types['Project'] do
is_expected.to have_graphql_fields(*expected_fields)
end
describe 'issue field' do
subject { described_class.fields['issue'] }
it 'returns issue' do
is_expected.to have_graphql_type(Types::ExtendedIssueType)
is_expected.to have_graphql_resolver(Resolvers::IssuesResolver.single)
end
end
describe 'issues field' do
subject { described_class.fields['issues'] }
it 'returns issue' do
is_expected.to have_graphql_type(Types::IssueType.connection_type)
is_expected.to have_graphql_resolver(Resolvers::IssuesResolver)
end
end
end
......@@ -176,7 +176,7 @@ describe('Flash', () => {
it('removes element after clicking', () => {
flash('test', 'alert', document, null, false, true);
document.querySelector('.flash-alert').click();
document.querySelector('.flash-alert .js-close-icon').click();
expect(document.querySelector('.flash-alert')).toBeNull();
......@@ -210,7 +210,13 @@ describe('Flash', () => {
describe('removeFlashClickListener', () => {
beforeEach(() => {
document.body.innerHTML += '<div class="flash-container"><div class="flash"></div></div>';
document.body.innerHTML += `
<div class="flash-container">
<div class="flash">
<div class="close-icon js-close-icon"></div>
</div>
</div>
`;
});
it('removes global flash on click', done => {
......@@ -218,7 +224,7 @@ describe('Flash', () => {
removeFlashClickListener(flashEl, false);
flashEl.click();
flashEl.querySelector('.js-close-icon').click();
setTimeout(() => {
expect(document.querySelector('.flash')).toBeNull();
......
......@@ -17,13 +17,27 @@ describe IssuePresenter do
describe '#web_url' do
it 'returns correct path' do
expect(presenter.web_url).to eq "http://localhost/#{group.name}/#{project.name}/issues/#{issue.iid}"
expect(presenter.web_url).to eq("http://localhost/#{group.name}/#{project.name}/issues/#{issue.iid}")
end
end
describe '#subscribed?' do
subject { presenter.subscribed? }
it 'returns not subscribed' do
is_expected.to be(false)
end
it 'returns subscribed' do
create(:subscription, user: user, project: project, subscribable: issue, subscribed: true)
is_expected.to be(true)
end
end
describe '#issue_path' do
it 'returns correct path' do
expect(presenter.issue_path).to eq "/#{group.name}/#{project.name}/issues/#{issue.iid}"
expect(presenter.issue_path).to eq("/#{group.name}/#{project.name}/issues/#{issue.iid}")
end
end
end
......@@ -10,6 +10,7 @@ require 'rspec/rails'
require 'shoulda/matchers'
require 'rspec/retry'
require 'rspec-parameterized'
require "test_prof/recipes/rspec/let_it_be"
rspec_profiling_is_configured =
ENV['RSPEC_PROFILING_POSTGRES_URL'].present? ||
......
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