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
58f24bc1
Commit
58f24bc1
authored
Apr 08, 2020
by
nmilojevic1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix TreeRestorer and TreeSaver specs
- Remove Feature.enable - Use stub_feature_flag instead
parent
a7053fc2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
19 deletions
+18
-19
spec/lib/gitlab/import_export/project/tree_restorer_spec.rb
spec/lib/gitlab/import_export/project/tree_restorer_spec.rb
+7
-15
spec/lib/gitlab/import_export/project/tree_saver_spec.rb
spec/lib/gitlab/import_export/project/tree_saver_spec.rb
+11
-4
No files found.
spec/lib/gitlab/import_export/project/tree_restorer_spec.rb
View file @
58f24bc1
...
...
@@ -11,7 +11,7 @@ describe Gitlab::ImportExport::Project::TreeRestorer do
let
(
:shared
)
{
project
.
import_export_shared
}
RSpec
.
shared_examples
'project tree restorer work properly'
do
|
reader
|
RSpec
.
shared_examples
'project tree restorer work properly'
do
|
reader
,
ndjson_enabled
|
describe
'restore project tree'
do
before_all
do
# Using an admin for import, so we can check assignment of existing members
...
...
@@ -25,6 +25,9 @@ describe Gitlab::ImportExport::Project::TreeRestorer do
@project
=
create
(
:project
,
:builds_enabled
,
:issues_disabled
,
name:
'project'
,
path:
'project'
)
@shared
=
@project
.
import_export_shared
allow
(
Feature
).
to
receive
(
:enabled?
).
and_call_original
stub_feature_flags
(
project_import_ndjson:
ndjson_enabled
)
setup_import_export_config
(
'complex'
)
setup_reader
(
reader
)
...
...
@@ -999,23 +1002,12 @@ describe Gitlab::ImportExport::Project::TreeRestorer do
end
context
'enable ndjson import'
do
before_all
do
# Test suite `restore project tree` run `project_tree_restorer.restore` in `before_all`.
# `Enable all features by default for testing` happens in `before(:each)`
# So it requires manually enable feature flag to allow ndjson_reader
Feature
.
enable
(
:project_import_ndjson
)
end
it_behaves_like
'project tree restorer work properly'
,
:legacy_reader
it_behaves_like
'project tree restorer work properly'
,
:legacy_reader
,
true
it_behaves_like
'project tree restorer work properly'
,
:ndjson_reader
it_behaves_like
'project tree restorer work properly'
,
:ndjson_reader
,
true
end
context
'disable ndjson import'
do
before
do
stub_feature_flags
(
project_import_ndjson:
false
)
end
it_behaves_like
'project tree restorer work properly'
,
:legacy_reader
it_behaves_like
'project tree restorer work properly'
,
:legacy_reader
,
false
end
end
spec/lib/gitlab/import_export/project/tree_saver_spec.rb
View file @
58f24bc1
...
...
@@ -16,7 +16,6 @@ describe Gitlab::ImportExport::Project::TreeSaver do
let_it_be
(
:group
)
{
create
(
:group
)
}
let_it_be
(
:project
)
{
setup_project
}
let_it_be
(
:shared
)
{
project
.
import_export_shared
}
let_it_be
(
:project_tree_saver
)
{
described_class
.
new
(
project:
project
,
current_user:
user
,
shared:
shared
)
}
let
(
:relation_name
)
{
:projects
}
...
...
@@ -29,9 +28,17 @@ describe Gitlab::ImportExport::Project::TreeSaver do
end
before_all
do
Feature
.
enable
(
:project_export_as_ndjson
)
if
ndjson_enabled
project
.
add_maintainer
(
user
)
project_tree_saver
.
save
RSpec
::
Mocks
.
with_temporary_scope
do
allow
(
Feature
).
to
receive
(
:enabled?
).
and_call_original
stub_feature_flags
(
project_export_as_ndjson:
ndjson_enabled
)
project
.
add_maintainer
(
user
)
stub_feature_flags
(
project_export_as_ndjson:
ndjson_enabled
)
project_tree_saver
=
described_class
.
new
(
project:
project
,
current_user:
user
,
shared:
shared
)
project_tree_saver
.
save
end
end
after
:all
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