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
2bac79a9
Commit
2bac79a9
authored
Oct 30, 2020
by
Ragnar-H
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move feature flag specs down a test level
Controller specs are more focused and run faster.
parent
97c8f825
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
89 additions
and
74 deletions
+89
-74
ee/spec/controllers/groups/usage_quotas_controller_spec.rb
ee/spec/controllers/groups/usage_quotas_controller_spec.rb
+51
-0
ee/spec/controllers/profiles/usage_quotas_controller_spec.rb
ee/spec/controllers/profiles/usage_quotas_controller_spec.rb
+38
-0
ee/spec/features/groups/usage_quotas_spec.rb
ee/spec/features/groups/usage_quotas_spec.rb
+0
-37
ee/spec/features/profiles/usage_quotas_spec.rb
ee/spec/features/profiles/usage_quotas_spec.rb
+0
-37
No files found.
ee/spec/controllers/groups/usage_quotas_controller_spec.rb
0 → 100644
View file @
2bac79a9
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
Groups
::
UsageQuotasController
do
let_it_be
(
:group
)
{
create
(
:group
,
:private
)
}
let_it_be
(
:user
)
{
create
(
:user
)
}
before
do
sign_in
(
user
)
group
.
add_owner
(
user
)
end
describe
'Pushing the `additionalRepoStorageByNamespace` feature flag to the frontend'
do
context
'when both flags are true'
do
before
do
stub_feature_flags
(
additional_repo_storage_by_namespace:
true
,
namespace_storage_limit:
true
)
end
it
'is disabled'
do
get
:index
,
params:
{
group_id:
group
}
expect
(
Gon
.
features
).
to
include
(
'additionalRepoStorageByNamespace'
=>
false
)
end
end
context
'when `namespace_storage_limit` flag is false'
do
before
do
stub_feature_flags
(
additional_repo_storage_by_namespace:
true
,
namespace_storage_limit:
false
)
end
it
'is enabled'
do
get
:index
,
params:
{
group_id:
group
}
expect
(
Gon
.
features
).
to
include
(
'additionalRepoStorageByNamespace'
=>
true
)
end
end
context
'when both flags are false'
do
before
do
stub_feature_flags
(
additional_repo_storage_by_namespace:
false
,
namespace_storage_limit:
false
)
end
it
'is disabled'
do
get
:index
,
params:
{
group_id:
group
}
expect
(
Gon
.
features
).
to
include
(
'additionalRepoStorageByNamespace'
=>
false
)
end
end
end
end
ee/spec/controllers/profiles/usage_quotas_controller_spec.rb
View file @
2bac79a9
...
...
@@ -16,4 +16,42 @@ RSpec.describe Profiles::UsageQuotasController do
expect
(
subject
).
to
render_template
(
:index
)
end
end
describe
'Pushing the `additionalRepoStorageByNamespace` feature flag to the frontend'
do
context
'when both flags are true'
do
before
do
stub_feature_flags
(
additional_repo_storage_by_namespace:
true
,
namespace_storage_limit:
true
)
end
it
'is disabled'
do
get
:index
expect
(
Gon
.
features
).
to
include
(
'additionalRepoStorageByNamespace'
=>
false
)
end
end
context
'when `namespace_storage_limit` flag is false'
do
before
do
stub_feature_flags
(
additional_repo_storage_by_namespace:
true
,
namespace_storage_limit:
false
)
end
it
'is enabled'
do
get
:index
expect
(
Gon
.
features
).
to
include
(
'additionalRepoStorageByNamespace'
=>
true
)
end
end
context
'when both flags are false'
do
before
do
stub_feature_flags
(
additional_repo_storage_by_namespace:
false
,
namespace_storage_limit:
false
)
end
it
'is disabled'
do
get
:index
expect
(
Gon
.
features
).
to
include
(
'additionalRepoStorageByNamespace'
=>
false
)
end
end
end
end
ee/spec/features/groups/usage_quotas_spec.rb
View file @
2bac79a9
...
...
@@ -9,49 +9,12 @@ RSpec.describe 'Groups > Usage Quotas' do
let
(
:gitlab_dot_com
)
{
true
}
before
do
stub_feature_flags
(
additional_repo_storage_by_namespace:
true
,
namespace_storage_limit:
false
)
allow
(
Gitlab
).
to
receive
(
:com?
).
and_return
(
gitlab_dot_com
)
group
.
add_owner
(
user
)
sign_in
(
user
)
end
it
'pushes frontend feature flags'
do
visit
visit_pipeline_quota_page
expect
(
page
).
to
have_pushed_frontend_feature_flags
(
additionalRepoStorageByNamespace:
true
)
end
context
'when `additional_repo_storage_by_namespace` is disabled for a group'
do
before
do
stub_feature_flags
(
additional_repo_storage_by_namespace:
false
,
thing:
group
)
end
it
'pushes disabled feature flag to the frontend'
do
visit
visit_pipeline_quota_page
expect
(
page
).
to
have_pushed_frontend_feature_flags
(
additionalRepoStorageByNamespace:
false
)
end
end
context
'when `additional_repo_storage_by_namespace` is overruled by `namespace_storage_limit`'
do
before
do
stub_feature_flags
(
namespace_storage_limit:
true
,
thing:
group
)
end
it
'pushes disabled feature flag to the frontend'
do
visit
profile_usage_quotas_path
expect
(
page
).
to
have_pushed_frontend_feature_flags
(
additionalRepoStorageByNamespace:
false
)
end
end
shared_examples
'linked in group settings dropdown'
do
it
'is linked within the group settings dropdown'
do
visit
edit_group_path
(
group
)
...
...
ee/spec/features/profiles/usage_quotas_spec.rb
View file @
2bac79a9
...
...
@@ -12,46 +12,9 @@ RSpec.describe 'Profile > Usage Quota' do
let_it_be
(
:other_project
)
{
create
(
:project
,
namespace:
namespace
,
shared_runners_enabled:
false
)
}
before
do
stub_feature_flags
(
additional_repo_storage_by_namespace:
true
,
namespace_storage_limit:
false
)
gitlab_sign_in
(
user
)
end
it
'pushes frontend feature flags'
do
visit
profile_usage_quotas_path
expect
(
page
).
to
have_pushed_frontend_feature_flags
(
additionalRepoStorageByNamespace:
true
)
end
context
'when `additional_repo_storage_by_namespace` is disabled for a namespace'
do
before
do
stub_feature_flags
(
additional_repo_storage_by_namespace:
false
,
thing:
namespace
)
end
it
'pushes disabled feature flag to the frontend'
do
visit
profile_usage_quotas_path
expect
(
page
).
to
have_pushed_frontend_feature_flags
(
additionalRepoStorageByNamespace:
false
)
end
end
context
'when `additional_repo_storage_by_namespace` is overruled by `namespace_storage_limit`'
do
before
do
stub_feature_flags
(
namespace_storage_limit:
true
,
thing:
namespace
)
end
it
'pushes disabled feature flag to the frontend'
do
visit
profile_usage_quotas_path
expect
(
page
).
to
have_pushed_frontend_feature_flags
(
additionalRepoStorageByNamespace:
false
)
end
end
it
'is linked within the profile page'
do
visit
profile_path
...
...
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