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
14c87fa1
Commit
14c87fa1
authored
Dec 13, 2021
by
huzaifaiftikhar1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add RSpecs and remove redundant method 'paid_plans'
parent
1248d0f3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
62 additions
and
5 deletions
+62
-5
ee/app/controllers/ee/dashboard/projects_controller.rb
ee/app/controllers/ee/dashboard/projects_controller.rb
+1
-1
ee/app/models/ee/plan.rb
ee/app/models/ee/plan.rb
+0
-4
ee/spec/helpers/nav/top_nav_helper_spec.rb
ee/spec/helpers/nav/top_nav_helper_spec.rb
+61
-0
No files found.
ee/app/controllers/ee/dashboard/projects_controller.rb
View file @
14c87fa1
...
...
@@ -51,7 +51,7 @@ module EE
# only list projects with at least owner access if the user is not an admin
finder_params
[
:min_access_level
]
=
::
Gitlab
::
Access
::
OWNER
# only list projects that belongs to a group with premium or above plan
finder_params
[
:plans
]
=
(
::
Plan
.
paid_plans
-
[
::
Plan
::
BRONZE
])
finder_params
[
:plans
]
=
(
::
Plan
::
PAID_HOSTED_PLANS
-
[
::
Plan
::
BRONZE
])
end
finder_params
...
...
ee/app/models/ee/plan.rb
View file @
14c87fa1
...
...
@@ -39,10 +39,6 @@ module EE
EE_DEFAULT_PLANS
end
def
paid_plans
PAID_HOSTED_PLANS
end
# This always returns an object if running on GitLab.com
def
free
return
unless
::
Gitlab
.
com?
...
...
ee/spec/helpers/nav/top_nav_helper_spec.rb
View file @
14c87fa1
...
...
@@ -10,6 +10,7 @@ RSpec.describe Nav::TopNavHelper do
let
(
:with_environments
)
{
false
}
let
(
:with_operations
)
{
false
}
let
(
:with_security
)
{
false
}
let
(
:with_projects
)
{
false
}
let
(
:with_geo_secondary
)
{
false
}
let
(
:with_geo_primary_node_configured
)
{
false
}
...
...
@@ -27,6 +28,7 @@ RSpec.describe Nav::TopNavHelper do
allow
(
helper
).
to
receive
(
:dashboard_nav_link?
).
with
(
:environments
)
{
with_environments
}
allow
(
helper
).
to
receive
(
:dashboard_nav_link?
).
with
(
:operations
)
{
with_operations
}
allow
(
helper
).
to
receive
(
:dashboard_nav_link?
).
with
(
:security
)
{
with_security
}
allow
(
helper
).
to
receive
(
:dashboard_nav_link?
).
with
(
:projects
)
{
with_projects
}
allow
(
::
Gitlab
::
Geo
).
to
receive
(
:secondary?
)
{
with_geo_secondary
}
allow
(
::
Gitlab
::
Geo
).
to
receive
(
:primary_node_configured?
)
{
with_geo_primary_node_configured
}
...
...
@@ -102,5 +104,64 @@ RSpec.describe Nav::TopNavHelper do
expect
(
subject
[
:secondary
]).
to
eq
([
expected_secondary
])
end
end
context
'with projects'
do
let
(
:with_projects
)
{
true
}
let
(
:projects_view
)
{
subject
[
:views
][
:projects
]
}
it
'has expected :primary'
do
expected_primary
=
::
Gitlab
::
Nav
::
TopNavMenuItem
.
build
(
css_class:
'qa-projects-dropdown'
,
data:
{
track_action:
'click_dropdown'
,
track_label:
'projects_dropdown'
},
icon:
'project'
,
id:
'project'
,
title:
'Projects'
,
view:
'projects'
)
expect
(
subject
[
:primary
]).
to
eq
([
expected_primary
])
end
context
'projects'
do
context
'when licensed feature is available'
do
before
do
stub_licensed_features
(
adjourned_deletion_for_projects_and_groups:
true
)
end
it
'has expected :linksPrimary'
do
expected_links_primary
=
[
::
Gitlab
::
Nav
::
TopNavMenuItem
.
build
(
href:
'/dashboard/projects/removed'
,
id:
'deleted'
,
title:
'Deleted projects'
),
::
Gitlab
::
Nav
::
TopNavMenuItem
.
build
(
href:
'/dashboard/projects'
,
id:
'your'
,
title:
'Your projects'
),
::
Gitlab
::
Nav
::
TopNavMenuItem
.
build
(
href:
'/dashboard/projects/starred'
,
id:
'starred'
,
title:
'Starred projects'
),
::
Gitlab
::
Nav
::
TopNavMenuItem
.
build
(
href:
'/explore'
,
id:
'explore'
,
title:
'Explore projects'
),
::
Gitlab
::
Nav
::
TopNavMenuItem
.
build
(
href:
'/explore/projects/topics'
,
id:
'topics'
,
title:
'Explore topics'
)
]
expect
(
projects_view
[
:linksPrimary
]).
to
eq
(
expected_links_primary
)
end
end
end
end
end
end
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