Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
4240e055
Commit
4240e055
authored
Oct 30, 2020
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab master
parents
5e8db1dc
d99701be
Changes
23
Show whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
272 additions
and
31 deletions
+272
-31
app/assets/javascripts/pages/projects/ci/pipeline_editor/show/index.js
...vascripts/pages/projects/ci/pipeline_editor/show/index.js
+3
-0
app/assets/javascripts/pipeline_editor/index.js
app/assets/javascripts/pipeline_editor/index.js
+13
-0
app/assets/javascripts/pipeline_editor/pipeline_editor_app.vue
...ssets/javascripts/pipeline_editor/pipeline_editor_app.vue
+26
-0
app/controllers/projects/ci/pipeline_editor_controller.rb
app/controllers/projects/ci/pipeline_editor_controller.rb
+17
-0
app/helpers/ci/pipeline_editor_helper.rb
app/helpers/ci/pipeline_editor_helper.rb
+12
-0
app/views/layouts/nav/sidebar/_project.html.haml
app/views/layouts/nav/sidebar/_project.html.haml
+8
-2
app/views/projects/ci/pipeline_editor/show.html.haml
app/views/projects/ci/pipeline_editor/show.html.haml
+3
-0
config/feature_flags/development/ci_pipeline_editor_page.yml
config/feature_flags/development/ci_pipeline_editor_page.yml
+7
-0
config/routes/project.rb
config/routes/project.rb
+1
-0
lib/gitlab/ci/features.rb
lib/gitlab/ci/features.rb
+4
-0
lib/gitlab/import_export/json/ndjson_reader.rb
lib/gitlab/import_export/json/ndjson_reader.rb
+2
-7
lib/gitlab/import_export/project/sample/date_calculator.rb
lib/gitlab/import_export/project/sample/date_calculator.rb
+0
-1
lib/gitlab/import_export/project/sample/sample_data_relation_tree_restorer.rb
...port/project/sample/sample_data_relation_tree_restorer.rb
+5
-6
locale/gitlab.pot
locale/gitlab.pot
+9
-0
spec/controllers/projects/ci/pipeline_editor_controller_spec.rb
...ontrollers/projects/ci/pipeline_editor_controller_spec.rb
+53
-0
spec/features/issuables/close_reopen_report_toggle_spec.rb
spec/features/issuables/close_reopen_report_toggle_spec.rb
+4
-4
spec/features/projects/ci/editor_spec.rb
spec/features/projects/ci/editor_spec.rb
+21
-0
spec/frontend/pipeline_editor/pipeline_editor_app_spec.js
spec/frontend/pipeline_editor/pipeline_editor_app_spec.js
+28
-0
spec/helpers/ci/pipeline_editor_helper_spec.rb
spec/helpers/ci/pipeline_editor_helper_spec.rb
+30
-0
spec/lib/gitlab/import_export/json/ndjson_reader_spec.rb
spec/lib/gitlab/import_export/json/ndjson_reader_spec.rb
+8
-10
spec/lib/gitlab/import_export/project/sample/date_calculator_spec.rb
...tlab/import_export/project/sample/date_calculator_spec.rb
+1
-1
spec/support/shared_contexts/navbar_structure_context.rb
spec/support/shared_contexts/navbar_structure_context.rb
+1
-0
spec/views/layouts/nav/sidebar/_project.html.haml_spec.rb
spec/views/layouts/nav/sidebar/_project.html.haml_spec.rb
+16
-0
No files found.
app/assets/javascripts/pages/projects/ci/pipeline_editor/show/index.js
0 → 100644
View file @
4240e055
import
{
initPipelineEditor
}
from
'
~/pipeline_editor
'
;
initPipelineEditor
();
app/assets/javascripts/pipeline_editor/index.js
0 → 100644
View file @
4240e055
import
Vue
from
'
vue
'
;
import
PipelineEditorApp
from
'
./pipeline_editor_app.vue
'
;
export
const
initPipelineEditor
=
(
selector
=
'
#js-pipeline-editor
'
)
=>
{
const
el
=
document
.
querySelector
(
selector
);
return
new
Vue
({
el
,
render
(
h
)
{
return
h
(
PipelineEditorApp
);
},
});
};
app/assets/javascripts/pipeline_editor/pipeline_editor_app.vue
0 → 100644
View file @
4240e055
<
script
>
import
{
GlEmptyState
}
from
'
@gitlab/ui
'
;
import
{
__
,
s__
}
from
'
~/locale
'
;
export
default
{
components
:
{
GlEmptyState
,
},
i18n
:
{
title
:
s__
(
'
Pipelines|Pipeline Editor
'
),
description
:
s__
(
'
Pipelines|We are beginning our work around building the foundation for our dedicated pipeline editor.
'
,
),
primaryButtonText
:
__
(
'
Learn more
'
),
},
};
</
script
>
<
template
>
<gl-empty-state
:title=
"$options.i18n.title"
:description=
"$options.i18n.description"
:primary-button-text=
"$options.i18n.primaryButtonText"
primary-button-link=
"https://about.gitlab.com/direction/verify/pipeline_authoring/"
/>
</
template
>
app/controllers/projects/ci/pipeline_editor_controller.rb
0 → 100644
View file @
4240e055
# frozen_string_literal: true
class
Projects::Ci::PipelineEditorController
<
Projects
::
ApplicationController
before_action
:check_can_collaborate!
feature_category
:pipeline_authoring
def
show
render_404
unless
::
Gitlab
::
Ci
::
Features
.
ci_pipeline_editor_page_enabled?
(
@project
)
end
private
def
check_can_collaborate!
render_404
unless
can_collaborate_with_project?
(
@project
)
end
end
app/helpers/ci/pipeline_editor_helper.rb
0 → 100644
View file @
4240e055
# frozen_string_literal: true
module
Ci
module
PipelineEditorHelper
include
ChecksCollaboration
def
can_view_pipeline_editor?
(
project
)
can_collaborate_with_project?
(
project
)
&&
Gitlab
::
Ci
::
Features
.
ci_pipeline_editor_page_enabled?
(
project
)
end
end
end
app/views/layouts/nav/sidebar/_project.html.haml
View file @
4240e055
...
@@ -167,7 +167,7 @@
...
@@ -167,7 +167,7 @@
=
render_if_exists
"layouts/nav/requirements_link"
,
project:
@project
=
render_if_exists
"layouts/nav/requirements_link"
,
project:
@project
-
if
project_nav_tab?
:pipelines
-
if
project_nav_tab?
:pipelines
=
nav_link
(
controller:
[
:pipelines
,
:builds
,
:jobs
,
:pipeline_schedules
,
:artifacts
,
:test_cases
],
unless:
->
{
current_path?
(
'projects/pipelines#charts'
)
})
do
=
nav_link
(
controller:
[
:pipelines
,
:builds
,
:jobs
,
:pipeline_schedules
,
:artifacts
,
:test_cases
,
:pipeline_editor
],
unless:
->
{
current_path?
(
'projects/pipelines#charts'
)
})
do
=
link_to
project_pipelines_path
(
@project
),
class:
'shortcuts-pipelines qa-link-pipelines rspec-link-pipelines'
,
data:
{
qa_selector:
'ci_cd_link'
}
do
=
link_to
project_pipelines_path
(
@project
),
class:
'shortcuts-pipelines qa-link-pipelines rspec-link-pipelines'
,
data:
{
qa_selector:
'ci_cd_link'
}
do
.nav-icon-container
.nav-icon-container
=
sprite_icon
(
'rocket'
)
=
sprite_icon
(
'rocket'
)
...
@@ -175,7 +175,7 @@
...
@@ -175,7 +175,7 @@
=
_
(
'CI / CD'
)
=
_
(
'CI / CD'
)
%ul
.sidebar-sub-level-items
%ul
.sidebar-sub-level-items
=
nav_link
(
controller:
[
:pipelines
,
:builds
,
:jobs
,
:pipeline_schedules
,
:artifacts
,
:test_cases
],
html_options:
{
class:
"fly-out-top-item"
})
do
=
nav_link
(
controller:
[
:pipelines
,
:builds
,
:jobs
,
:pipeline_schedules
,
:artifacts
,
:test_cases
,
:pipeline_editor
],
html_options:
{
class:
"fly-out-top-item"
})
do
=
link_to
project_pipelines_path
(
@project
)
do
=
link_to
project_pipelines_path
(
@project
)
do
%strong
.fly-out-top-item-name
%strong
.fly-out-top-item-name
=
_
(
'CI / CD'
)
=
_
(
'CI / CD'
)
...
@@ -186,6 +186,12 @@
...
@@ -186,6 +186,12 @@
%span
%span
=
_
(
'Pipelines'
)
=
_
(
'Pipelines'
)
-
if
can_view_pipeline_editor?
(
@project
)
=
nav_link
(
controller: :pipeline_editor
,
action: :show
)
do
=
link_to
project_ci_pipeline_editor_path
(
@project
),
title:
s_
(
'Pipelines|Editor'
)
do
%span
=
s_
(
'Pipelines|Editor'
)
-
if
project_nav_tab?
:builds
-
if
project_nav_tab?
:builds
=
nav_link
(
controller: :jobs
)
do
=
nav_link
(
controller: :jobs
)
do
=
link_to
project_jobs_path
(
@project
),
title:
_
(
'Jobs'
),
class:
'shortcuts-builds'
do
=
link_to
project_jobs_path
(
@project
),
title:
_
(
'Jobs'
),
class:
'shortcuts-builds'
do
...
...
app/views/projects/ci/pipeline_editor/show.html.haml
0 → 100644
View file @
4240e055
-
page_title
s_
(
'Pipelines|Pipeline Editor'
)
#js-pipeline-editor
config/feature_flags/development/ci_pipeline_editor_page.yml
0 → 100644
View file @
4240e055
---
name
:
ci_pipeline_editor_page
introduced_by_url
:
rollout_issue_url
:
https://gitlab.com/gitlab-org/gitlab/-/issues/270059
type
:
development
group
:
group::pipeline authoring
default_enabled
:
false
config/routes/project.rb
View file @
4240e055
...
@@ -85,6 +85,7 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
...
@@ -85,6 +85,7 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
namespace
:ci
do
namespace
:ci
do
resource
:lint
,
only:
[
:show
,
:create
]
resource
:lint
,
only:
[
:show
,
:create
]
resource
:pipeline_editor
,
only:
[
:show
],
controller: :pipeline_editor
,
path:
'editor'
resources
:daily_build_group_report_results
,
only:
[
:index
],
constraints:
{
format:
/(csv|json)/
}
resources
:daily_build_group_report_results
,
only:
[
:index
],
constraints:
{
format:
/(csv|json)/
}
end
end
...
...
lib/gitlab/ci/features.rb
View file @
4240e055
...
@@ -66,6 +66,10 @@ module Gitlab
...
@@ -66,6 +66,10 @@ module Gitlab
def
self
.
seed_block_run_before_workflow_rules_enabled?
(
project
)
def
self
.
seed_block_run_before_workflow_rules_enabled?
(
project
)
::
Feature
.
enabled?
(
:ci_seed_block_run_before_workflow_rules
,
project
,
default_enabled:
false
)
::
Feature
.
enabled?
(
:ci_seed_block_run_before_workflow_rules
,
project
,
default_enabled:
false
)
end
end
def
self
.
ci_pipeline_editor_page_enabled?
(
project
)
::
Feature
.
enabled?
(
:ci_pipeline_editor_page
,
project
,
default_enabled:
false
)
end
end
end
end
end
end
end
lib/gitlab/import_export/json/ndjson_reader.rb
View file @
4240e055
...
@@ -29,9 +29,9 @@ module Gitlab
...
@@ -29,9 +29,9 @@ module Gitlab
json_decode
(
data
)
json_decode
(
data
)
end
end
def
consume_relation
(
importable_path
,
key
)
def
consume_relation
(
importable_path
,
key
,
mark_as_consumed:
true
)
Enumerator
.
new
do
|
documents
|
Enumerator
.
new
do
|
documents
|
next
unless
@consumed_relations
.
add?
(
"
#{
importable_path
}
/
#{
key
}
"
)
next
if
mark_as_consumed
&&
!
@consumed_relations
.
add?
(
"
#{
importable_path
}
/
#{
key
}
"
)
# This reads from `tree/project/merge_requests.ndjson`
# This reads from `tree/project/merge_requests.ndjson`
path
=
file_path
(
importable_path
,
"
#{
key
}
.ndjson"
)
path
=
file_path
(
importable_path
,
"
#{
key
}
.ndjson"
)
...
@@ -44,11 +44,6 @@ module Gitlab
...
@@ -44,11 +44,6 @@ module Gitlab
end
end
end
end
# TODO: Move clear logic into main comsume_relation method (see https://gitlab.com/gitlab-org/gitlab/-/merge_requests/41699#note_430465330)
def
clear_consumed_relations
@consumed_relations
.
clear
end
private
private
def
json_decode
(
string
)
def
json_decode
(
string
)
...
...
lib/gitlab/import_export/project/sample/date_calculator.rb
View file @
4240e055
...
@@ -9,7 +9,6 @@ module Gitlab
...
@@ -9,7 +9,6 @@ module Gitlab
def
initialize
(
dates
)
def
initialize
(
dates
)
@dates
=
dates
.
dup
@dates
=
dates
.
dup
@dates
.
flatten!
@dates
.
compact!
@dates
.
compact!
@dates
.
sort!
@dates
.
sort!
@dates
.
map!
{
|
date
|
date
.
to_time
.
to_f
}
@dates
.
map!
{
|
date
|
date
.
to_time
.
to_f
}
...
...
lib/gitlab/import_export/project/sample/sample_data_relation_tree_restorer.rb
View file @
4240e055
...
@@ -30,13 +30,12 @@ module Gitlab
...
@@ -30,13 +30,12 @@ module Gitlab
data_hash
[
'due_date'
]
=
date_calculator
.
calculate_by_closest_date_to_average
(
data_hash
[
'due_date'
].
to_time
)
unless
data_hash
[
'due_date'
].
nil?
data_hash
[
'due_date'
]
=
date_calculator
.
calculate_by_closest_date_to_average
(
data_hash
[
'due_date'
].
to_time
)
unless
data_hash
[
'due_date'
].
nil?
end
end
# TODO: Move clear logic into main comsume_relation method (see https://gitlab.com/gitlab-org/gitlab/-/merge_requests/41699#note_430465330)
def
dates
def
dates
unless
relation_reader
.
legacy?
return
if
relation_reader
.
legacy?
DATE_MODELS
.
map
do
|
tag
|
relation_reader
.
consume_relation
(
@importable_path
,
tag
).
map
{
|
model
|
model
.
first
[
'due_date'
]
}.
tap
do
DATE_MODELS
.
flat_map
do
|
tag
|
relation_reader
.
clear_consumed_relations
relation_reader
.
consume_relation
(
@importable_path
,
tag
,
mark_as_consumed:
false
).
map
do
|
model
|
end
model
.
first
[
'due_date'
]
end
end
end
end
end
end
...
...
locale/gitlab.pot
View file @
4240e055
...
@@ -19537,6 +19537,9 @@ msgstr ""
...
@@ -19537,6 +19537,9 @@ msgstr ""
msgid "Pipelines|Edit"
msgid "Pipelines|Edit"
msgstr ""
msgstr ""
msgid "Pipelines|Editor"
msgstr ""
msgid "Pipelines|Get started with Pipelines"
msgid "Pipelines|Get started with Pipelines"
msgstr ""
msgstr ""
...
@@ -19567,6 +19570,9 @@ msgstr ""
...
@@ -19567,6 +19570,9 @@ msgstr ""
msgid "Pipelines|Owner"
msgid "Pipelines|Owner"
msgstr ""
msgstr ""
msgid "Pipelines|Pipeline Editor"
msgstr ""
msgid "Pipelines|Project cache successfully reset."
msgid "Pipelines|Project cache successfully reset."
msgstr ""
msgstr ""
...
@@ -19603,6 +19609,9 @@ msgstr ""
...
@@ -19603,6 +19609,9 @@ msgstr ""
msgid "Pipelines|Trigger user has insufficient permissions to project"
msgid "Pipelines|Trigger user has insufficient permissions to project"
msgstr ""
msgstr ""
msgid "Pipelines|We are beginning our work around building the foundation for our dedicated pipeline editor."
msgstr ""
msgid "Pipelines|invalid"
msgid "Pipelines|invalid"
msgstr ""
msgstr ""
...
...
spec/controllers/projects/ci/pipeline_editor_controller_spec.rb
0 → 100644
View file @
4240e055
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
Projects
::
Ci
::
PipelineEditorController
do
let_it_be
(
:project
)
{
create
(
:project
,
:repository
)
}
let_it_be
(
:user
)
{
create
(
:user
)
}
before
do
sign_in
(
user
)
end
describe
'GET #show'
do
context
'with enough privileges'
do
before
do
project
.
add_developer
(
user
)
get
:show
,
params:
{
namespace_id:
project
.
namespace
,
project_id:
project
}
end
it
{
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
}
it
'renders show page'
do
expect
(
response
).
to
render_template
:show
end
end
context
'without enough privileges'
do
before
do
project
.
add_reporter
(
user
)
get
:show
,
params:
{
namespace_id:
project
.
namespace
,
project_id:
project
}
end
it
'responds with 404'
do
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
context
'when ci_pipeline_editor_page feature flag is disabled'
do
before
do
stub_feature_flags
(
ci_pipeline_editor_page:
false
)
project
.
add_developer
(
user
)
get
:show
,
params:
{
namespace_id:
project
.
namespace
,
project_id:
project
}
end
it
'responds with 404'
do
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
end
end
spec/features/issuables/close_reopen_report_toggle_spec.rb
View file @
4240e055
...
@@ -95,7 +95,7 @@ RSpec.describe 'Issuables Close/Reopen/Report toggle' do
...
@@ -95,7 +95,7 @@ RSpec.describe 'Issuables Close/Reopen/Report toggle' do
expect
(
page
).
to
have_link
(
'New issue'
)
expect
(
page
).
to
have_link
(
'New issue'
)
expect
(
page
).
not_to
have_button
(
'Close issue'
)
expect
(
page
).
not_to
have_button
(
'Close issue'
)
expect
(
page
).
not_to
have_button
(
'Reopen issue'
)
expect
(
page
).
not_to
have_button
(
'Reopen issue'
)
expect
(
page
).
not_to
have_link
(
'Edit
'
)
expect
(
page
).
not_to
have_link
(
title:
'Edit title and description
'
)
end
end
end
end
end
end
...
@@ -121,7 +121,7 @@ RSpec.describe 'Issuables Close/Reopen/Report toggle' do
...
@@ -121,7 +121,7 @@ RSpec.describe 'Issuables Close/Reopen/Report toggle' do
it
'shows only the `Report abuse` and `Edit` button'
do
it
'shows only the `Report abuse` and `Edit` button'
do
expect
(
page
).
to
have_link
(
'Report abuse'
)
expect
(
page
).
to
have_link
(
'Report abuse'
)
expect
(
page
).
to
have_link
(
'Edit'
)
expect
(
page
).
to
have_link
(
exact_text:
'Edit'
)
expect
(
page
).
not_to
have_button
(
'Close merge request'
)
expect
(
page
).
not_to
have_button
(
'Close merge request'
)
expect
(
page
).
not_to
have_button
(
'Reopen merge request'
)
expect
(
page
).
not_to
have_button
(
'Reopen merge request'
)
end
end
...
@@ -130,8 +130,8 @@ RSpec.describe 'Issuables Close/Reopen/Report toggle' do
...
@@ -130,8 +130,8 @@ RSpec.describe 'Issuables Close/Reopen/Report toggle' do
let
(
:issuable
)
{
create
(
:merge_request
,
:merged
,
source_project:
project
,
author:
user
)
}
let
(
:issuable
)
{
create
(
:merge_request
,
:merged
,
source_project:
project
,
author:
user
)
}
it
'shows only the `Edit` button'
do
it
'shows only the `Edit` button'
do
expect
(
page
).
to
have_link
(
'Edit'
)
expect
(
page
).
to
have_link
(
'Report abuse'
)
expect
(
page
).
to
have_link
(
'Report abuse'
)
expect
(
page
).
to
have_link
(
exact_text:
'Edit'
)
expect
(
page
).
not_to
have_button
(
'Close merge request'
)
expect
(
page
).
not_to
have_button
(
'Close merge request'
)
expect
(
page
).
not_to
have_button
(
'Reopen merge request'
)
expect
(
page
).
not_to
have_button
(
'Reopen merge request'
)
end
end
...
@@ -153,7 +153,7 @@ RSpec.describe 'Issuables Close/Reopen/Report toggle' do
...
@@ -153,7 +153,7 @@ RSpec.describe 'Issuables Close/Reopen/Report toggle' do
expect
(
page
).
to
have_link
(
'Report abuse'
)
expect
(
page
).
to
have_link
(
'Report abuse'
)
expect
(
page
).
not_to
have_button
(
'Close merge request'
)
expect
(
page
).
not_to
have_button
(
'Close merge request'
)
expect
(
page
).
not_to
have_button
(
'Reopen merge request'
)
expect
(
page
).
not_to
have_button
(
'Reopen merge request'
)
expect
(
page
).
not_to
have_link
(
'Edit'
)
expect
(
page
).
not_to
have_link
(
exact_text:
'Edit'
)
end
end
end
end
end
end
...
...
spec/features/projects/ci/editor_spec.rb
0 → 100644
View file @
4240e055
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
'Pipeline Editor'
,
:js
do
include
Spec
::
Support
::
Helpers
::
Features
::
EditorLiteSpecHelpers
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:user
)
{
create
(
:user
)
}
before
do
sign_in
(
user
)
project
.
add_developer
(
user
)
visit
project_ci_pipeline_editor_path
(
project
)
end
it
'user sees the Pipeline Editor page'
do
expect
(
page
).
to
have_content
(
'Pipeline Editor'
)
end
end
spec/frontend/pipeline_editor/pipeline_editor_app_spec.js
0 → 100644
View file @
4240e055
import
{
mount
,
shallowMount
}
from
'
@vue/test-utils
'
;
import
{
GlEmptyState
}
from
'
@gitlab/ui
'
;
import
PipelineEditorApp
from
'
~/pipeline_editor/pipeline_editor_app.vue
'
;
describe
(
'
~/pipeline_editor/pipeline_editor_app.vue
'
,
()
=>
{
let
wrapper
;
const
createComponent
=
(
mountFn
=
shallowMount
)
=>
{
wrapper
=
mountFn
(
PipelineEditorApp
);
};
const
findEmptyState
=
()
=>
wrapper
.
find
(
GlEmptyState
);
it
(
'
contains an empty state
'
,
()
=>
{
createComponent
();
expect
(
findEmptyState
().
exists
()).
toBe
(
true
);
});
it
(
'
contains a text description
'
,
()
=>
{
createComponent
(
mount
);
expect
(
findEmptyState
().
text
()).
toMatchInterpolatedText
(
'
Pipeline Editor We are beginning our work around building the foundation for our dedicated pipeline editor. Learn more
'
,
);
});
});
spec/helpers/ci/pipeline_editor_helper_spec.rb
0 → 100644
View file @
4240e055
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
Ci
::
PipelineEditorHelper
do
let_it_be
(
:project
)
{
create
(
:project
)
}
describe
'can_view_pipeline_editor?'
do
subject
{
helper
.
can_view_pipeline_editor?
(
project
)
}
it
'user can view editor if they can collaborate'
do
allow
(
helper
).
to
receive
(
:can_collaborate_with_project?
).
and_return
(
true
)
expect
(
subject
).
to
be
true
end
it
'user can not view editor if they cannot collaborate'
do
allow
(
helper
).
to
receive
(
:can_collaborate_with_project?
).
and_return
(
false
)
expect
(
subject
).
to
be
false
end
it
'user can not view editor if feature is disabled'
do
allow
(
helper
).
to
receive
(
:can_collaborate_with_project?
).
and_return
(
true
)
stub_feature_flags
(
ci_pipeline_editor_page:
false
)
expect
(
subject
).
to
be
false
end
end
end
spec/lib/gitlab/import_export/json/ndjson_reader_spec.rb
View file @
4240e055
...
@@ -67,6 +67,14 @@ RSpec.describe Gitlab::ImportExport::JSON::NdjsonReader do
...
@@ -67,6 +67,14 @@ RSpec.describe Gitlab::ImportExport::JSON::NdjsonReader do
it
'yields nothing to the Enumerator'
do
it
'yields nothing to the Enumerator'
do
expect
(
subject
.
to_a
).
to
eq
([])
expect
(
subject
.
to_a
).
to
eq
([])
end
end
context
'with mark_as_consumed: false'
do
subject
{
ndjson_reader
.
consume_relation
(
importable_path
,
key
,
mark_as_consumed:
false
)
}
it
'yields every relation value to the Enumerator'
do
expect
(
subject
.
count
).
to
eq
(
1
)
end
end
end
end
context
'key has not been consumed'
do
context
'key has not been consumed'
do
...
@@ -102,14 +110,4 @@ RSpec.describe Gitlab::ImportExport::JSON::NdjsonReader do
...
@@ -102,14 +110,4 @@ RSpec.describe Gitlab::ImportExport::JSON::NdjsonReader do
end
end
end
end
end
end
describe
'#clear_consumed_relations'
do
let
(
:dir_path
)
{
fixture
}
subject
{
ndjson_reader
.
clear_consumed_relations
}
it
'returns empty set'
do
expect
(
subject
).
to
be_empty
end
end
end
end
spec/lib/gitlab/import_export/project/sample/date_calculator_spec.rb
View file @
4240e055
...
@@ -13,7 +13,7 @@ RSpec.describe Gitlab::ImportExport::Project::Sample::DateCalculator do
...
@@ -13,7 +13,7 @@ RSpec.describe Gitlab::ImportExport::Project::Sample::DateCalculator do
end
end
context
'when dates are not empty'
do
context
'when dates are not empty'
do
let
(
:dates
)
{
[
[
nil
,
'2020-01-01 00:00:00 +0000'
],
[
nil
,
'2021-01-01 00:00:00 +0000'
],
[
nil
,
'2022-01-01 23:59:59 +0000'
]
]
}
let
(
:dates
)
{
[
nil
,
'2020-01-01 00:00:00 +0000'
,
'2021-01-01 00:00:00 +0000'
,
nil
,
'2022-01-01 23:59:59 +0000'
]
}
it
{
is_expected
.
to
eq
(
Time
.
zone
.
parse
(
'2021-01-01 00:00:00 +0000'
))
}
it
{
is_expected
.
to
eq
(
Time
.
zone
.
parse
(
'2021-01-01 00:00:00 +0000'
))
}
end
end
...
...
spec/support/shared_contexts/navbar_structure_context.rb
View file @
4240e055
...
@@ -56,6 +56,7 @@ RSpec.shared_context 'project navbar structure' do
...
@@ -56,6 +56,7 @@ RSpec.shared_context 'project navbar structure' do
nav_item:
_
(
'CI / CD'
),
nav_item:
_
(
'CI / CD'
),
nav_sub_items:
[
nav_sub_items:
[
_
(
'Pipelines'
),
_
(
'Pipelines'
),
s_
(
'Pipelines|Editor'
),
_
(
'Jobs'
),
_
(
'Jobs'
),
_
(
'Artifacts'
),
_
(
'Artifacts'
),
_
(
'Schedules'
)
_
(
'Schedules'
)
...
...
spec/views/layouts/nav/sidebar/_project.html.haml_spec.rb
View file @
4240e055
...
@@ -219,6 +219,22 @@ RSpec.describe 'layouts/nav/sidebar/_project' do
...
@@ -219,6 +219,22 @@ RSpec.describe 'layouts/nav/sidebar/_project' do
end
end
end
end
describe
'pipeline editor link'
do
it
'shows the pipeline editor link'
do
render
expect
(
rendered
).
to
have_link
(
'Editor'
,
href:
project_ci_pipeline_editor_path
(
project
))
end
it
'does not show the pipeline editor link'
do
allow
(
view
).
to
receive
(
:can_view_pipeline_editor?
).
and_return
(
false
)
render
expect
(
rendered
).
not_to
have_link
(
'Editor'
,
href:
project_ci_pipeline_editor_path
(
project
))
end
end
describe
'operations settings tab'
do
describe
'operations settings tab'
do
describe
'archive projects'
do
describe
'archive projects'
do
before
do
before
do
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment