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
3863e46b
Commit
3863e46b
authored
Jun 19, 2017
by
Nick Thomas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Project#feature_available? specs
parent
16e88fff
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
42 deletions
+46
-42
spec/models/ee/project_spec.rb
spec/models/ee/project_spec.rb
+46
-42
No files found.
spec/models/ee/project_spec.rb
View file @
3863e46b
...
@@ -22,73 +22,77 @@ describe Project, models: true do
...
@@ -22,73 +22,77 @@ describe Project, models: true do
before
do
before
do
stub_application_setting
(
'check_namespace_plan?'
=>
check_namespace_plan
)
stub_application_setting
(
'check_namespace_plan?'
=>
check_namespace_plan
)
allow
(
Gitlab
).
to
receive
(
:com?
)
{
true
}
allow
(
Gitlab
).
to
receive
(
:com?
)
{
true
}
expect
_any_instance_of
(
License
).
to
receive
(
:feature_available?
).
with
(
feature
)
{
allowed_on_global_license
}
expect
(
License
).
to
receive
(
:feature_available?
).
with
(
feature
)
{
allowed_on_global_license
}
allow
(
namespace
).
to
receive
(
:plan
)
{
plan_license
}
allow
(
namespace
).
to
receive
(
:plan
)
{
plan_license
}
end
end
License
::
FEATURE_CODES
.
each
do
|
feature_sym
,
feature_code
|
License
::
FEATURE_CODES
.
each
do
|
feature_sym
,
feature_code
|
let
(
:feature
)
{
feature_sym
}
context
feature_sym
.
to_s
do
let
(
:feature_code
)
{
feature_code
}
let
(
:feature
)
{
feature_sym
}
let
(
:feature_code
)
{
feature_code
}
context
"checking
#{
feature
}
availabil
y both on Global and Namespace license"
do
context
"checking
#{
feature_sym
}
availabilit
y both on Global and Namespace license"
do
let
(
:check_namespace_plan
)
{
true
}
let
(
:check_namespace_plan
)
{
true
}
context
'allowed by Plan License AND Global License'
do
context
'allowed by Plan License AND Global License'
do
let
(
:allowed_on_global_license
)
{
true
}
let
(
:allowed_on_global_license
)
{
true
}
let
(
:plan_license
)
{
Namespace
::
GOLD_PLAN
}
let
(
:plan_license
)
{
Namespace
::
GOLD_PLAN
}
it
'returns true'
do
it
'returns true'
do
is_expected
.
to
eq
(
true
)
is_expected
.
to
eq
(
true
)
end
end
end
end
context
'not allowed by Plan License but project and namespace are public'
do
context
'not allowed by Plan License but project and namespace are public'
do
let
(
:allowed_on_global_license
)
{
true
}
let
(
:allowed_on_global_license
)
{
true
}
let
(
:plan_license
)
{
Namespace
::
BRONZE_PLAN
}
let
(
:plan_license
)
{
Namespace
::
BRONZE_PLAN
}
it
'returns true'
do
it
'returns true'
do
allow
(
namespace
).
to
receive
(
:public?
)
{
true
}
allow
(
namespace
).
to
receive
(
:public?
)
{
true
}
allow
(
project
).
to
receive
(
:public?
)
{
true
}
allow
(
project
).
to
receive
(
:public?
)
{
true
}
is_expected
.
to
eq
(
true
)
is_expected
.
to
eq
(
true
)
end
end
end
end
context
'not allowed by Plan License'
do
unless
License
.
plan_includes_feature?
(
License
::
STARTER_PLAN
,
feature_sym
)
let
(
:allowed_on_global_license
)
{
true
}
context
'not allowed by Plan License'
do
let
(
:plan_license
)
{
Namespace
::
BRONZE_PLAN
}
let
(
:allowed_on_global_license
)
{
true
}
let
(
:plan_license
)
{
Namespace
::
BRONZE_PLAN
}
it
'returns false'
do
it
'returns false'
do
is_expected
.
to
eq
(
false
)
is_expected
.
to
eq
(
false
)
end
end
end
end
end
context
'not allowed by Global License'
do
context
'not allowed by Global License'
do
let
(
:allowed_on_global_license
)
{
false
}
let
(
:allowed_on_global_license
)
{
false
}
let
(
:plan_license
)
{
Namespace
::
GOLD_PLAN
}
let
(
:plan_license
)
{
Namespace
::
GOLD_PLAN
}
it
'returns false'
do
it
'returns false'
do
is_expected
.
to
eq
(
false
)
is_expected
.
to
eq
(
false
)
end
end
end
end
end
end
context
"when checking
#{
feature_code
}
only for Global license"
do
context
"when checking
#{
feature_code
}
only for Global license"
do
let
(
:check_namespace_plan
)
{
false
}
let
(
:check_namespace_plan
)
{
false
}
context
'allowed by Global License'
do
context
'allowed by Global License'
do
let
(
:allowed_on_global_license
)
{
true
}
let
(
:allowed_on_global_license
)
{
true
}
it
'returns true'
do
it
'returns true'
do
is_expected
.
to
eq
(
true
)
is_expected
.
to
eq
(
true
)
end
end
end
end
context
'not allowed by Global License'
do
context
'not allowed by Global License'
do
let
(
:allowed_on_global_license
)
{
false
}
let
(
:allowed_on_global_license
)
{
false
}
it
'returns false'
do
it
'returns false'
do
is_expected
.
to
eq
(
false
)
is_expected
.
to
eq
(
false
)
end
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