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
d20cb5a7
Commit
d20cb5a7
authored
Dec 08, 2017
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update specs to create Plans on-demand
parent
9c177d23
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
46 additions
and
39 deletions
+46
-39
spec/controllers/projects/settings/integrations_controller_spec.rb
...rollers/projects/settings/integrations_controller_spec.rb
+1
-1
spec/ee/spec/controllers/projects/issues_controller_spec.rb
spec/ee/spec/controllers/projects/issues_controller_spec.rb
+1
-1
spec/ee/spec/lib/ee/gitlab/ci/pipeline/quota/activity_spec.rb
.../ee/spec/lib/ee/gitlab/ci/pipeline/quota/activity_spec.rb
+1
-1
spec/ee/spec/models/ee/namespace_spec.rb
spec/ee/spec/models/ee/namespace_spec.rb
+17
-15
spec/ee/spec/models/ee/project_spec.rb
spec/ee/spec/models/ee/project_spec.rb
+6
-6
spec/ee/spec/services/ee/projects/create_service_spec.rb
spec/ee/spec/services/ee/projects/create_service_spec.rb
+2
-1
spec/factories/namespaces.rb
spec/factories/namespaces.rb
+1
-1
spec/features/billings/billing_plans_spec.rb
spec/features/billings/billing_plans_spec.rb
+3
-3
spec/features/projects/push_rules_spec.rb
spec/features/projects/push_rules_spec.rb
+2
-2
spec/models/project_services/jenkins_deprecated_service_spec.rb
...odels/project_services/jenkins_deprecated_service_spec.rb
+1
-1
spec/models/project_services/jenkins_service_spec.rb
spec/models/project_services/jenkins_service_spec.rb
+1
-1
spec/models/push_rule_spec.rb
spec/models/push_rule_spec.rb
+4
-4
spec/requests/api/namespaces_spec.rb
spec/requests/api/namespaces_spec.rb
+4
-0
spec/requests/api/v3/github_spec.rb
spec/requests/api/v3/github_spec.rb
+1
-1
spec/workers/update_all_mirrors_worker_spec.rb
spec/workers/update_all_mirrors_worker_spec.rb
+1
-1
No files found.
spec/controllers/projects/settings/integrations_controller_spec.rb
View file @
d20cb5a7
...
...
@@ -77,7 +77,7 @@ describe Projects::Settings::IntegrationsController do
end
context
'and namespace has a plan'
do
let
(
:namespace
)
{
create
(
:group
,
:private
,
plan:
Namespace
::
BRONZE_PLAN
)
}
let
(
:namespace
)
{
create
(
:group
,
:private
,
plan:
:bronze_plan
)
}
it_behaves_like
'endpoint without disabled services'
end
...
...
spec/ee/spec/controllers/projects/issues_controller_spec.rb
View file @
d20cb5a7
...
...
@@ -60,7 +60,7 @@ describe Projects::IssuesController do
context
'licensed by namespace'
do
let
(
:globally_licensed
)
{
true
}
let
(
:namespace
)
{
create
(
:group
,
:private
,
plan:
Namespace
::
BRONZE_PLAN
)
}
let
(
:namespace
)
{
create
(
:group
,
:private
,
plan:
:bronze_plan
)
}
let
(
:project
)
{
create
(
:project
,
namespace:
namespace
)
}
before
do
...
...
spec/ee/spec/lib/ee/gitlab/ci/pipeline/quota/activity_spec.rb
View file @
d20cb5a7
require
'spec_helper'
describe
EE
::
Gitlab
::
Ci
::
Pipeline
::
Quota
::
Activity
do
set
(
:namespace
)
{
create
(
:namespace
,
plan:
EE
::
Namespace
::
GOLD_PLAN
)
}
set
(
:namespace
)
{
create
(
:namespace
,
plan:
:gold_plan
)
}
set
(
:project
)
{
create
(
:project
,
namespace:
namespace
)
}
let
(
:limit
)
{
described_class
.
new
(
namespace
,
project
)
}
...
...
spec/ee/spec/models/ee/namespace_spec.rb
View file @
d20cb5a7
...
...
@@ -15,7 +15,7 @@ describe Namespace do
let!
(
:namespace
)
{
create
:namespace
,
plan:
namespace_plan
}
context
'plan is set'
do
let
(
:namespace_plan
)
{
EE
::
Namespace
::
BRONZE_PLAN
}
let
(
:namespace_plan
)
{
:bronze_plan
}
it
'returns namespaces with plan'
do
expect
(
described_class
.
with_plan
).
to
eq
([
namespace
])
...
...
@@ -48,7 +48,7 @@ describe Namespace do
context
'with a valid plan name'
do
it
'is valid'
do
group
.
plan
=
Namespace
::
BRONZE_PLAN
group
.
plan
=
create
(
:bronze_plan
)
expect
(
group
).
to
be_valid
end
...
...
@@ -123,7 +123,7 @@ describe Namespace do
end
describe
'#feature_available?'
do
let
(
:plan_license
)
{
Namespace
::
BRONZE_PLAN
}
let
(
:plan_license
)
{
:bronze_plan
}
let
(
:group
)
{
create
(
:group
,
plan:
plan_license
)
}
let
(
:feature
)
{
:service_desk
}
...
...
@@ -155,7 +155,7 @@ describe Namespace do
end
context
'when feature available on the plan'
do
let
(
:plan_license
)
{
Namespace
::
GOLD_PLAN
}
let
(
:plan_license
)
{
:gold_plan
}
context
'when feature available for current group'
do
it
'returns true'
do
...
...
@@ -176,7 +176,7 @@ describe Namespace do
context
'when feature not available in the plan'
do
let
(
:feature
)
{
:deploy_board
}
let
(
:plan_license
)
{
Namespace
::
BRONZE_PLAN
}
let
(
:plan_license
)
{
:bronze_plan
}
it
'returns false'
do
is_expected
.
to
be_falsy
...
...
@@ -194,8 +194,7 @@ describe Namespace do
context
'when free plan has limit defined'
do
before
do
Plan
.
find_by
(
name:
Namespace
::
FREE_PLAN
)
.
update_column
(
:active_pipelines_limit
,
40
)
create
(
:free_plan
,
active_pipelines_limit:
40
)
end
it
'returns a free plan limits'
do
...
...
@@ -205,7 +204,7 @@ describe Namespace do
context
'when associated plan has no limit defined'
do
before
do
namespace
.
plan
=
Namespace
::
GOLD_PLAN
namespace
.
plan
=
create
(
:gold_plan
)
end
it
'returns zero'
do
...
...
@@ -215,7 +214,7 @@ describe Namespace do
context
'when limit is defined'
do
before
do
namespace
.
plan
=
Namespace
::
GOLD_PLAN
namespace
.
plan
=
create
(
:gold_plan
)
namespace
.
plan
.
update_column
(
:active_pipelines_limit
,
10
)
end
...
...
@@ -234,8 +233,7 @@ describe Namespace do
context
'when free plan has limit defined'
do
before
do
Plan
.
find_by
(
name:
Namespace
::
FREE_PLAN
)
.
update_column
(
:pipeline_size_limit
,
40
)
create
(
:free_plan
,
pipeline_size_limit:
40
)
end
it
'returns a free plan limits'
do
...
...
@@ -245,7 +243,7 @@ describe Namespace do
context
'when associated plan has no limits defined'
do
before
do
namespace
.
plan
=
Namespace
::
GOLD_PLAN
namespace
.
plan
=
create
(
:gold_plan
)
end
it
'returns zero'
do
...
...
@@ -255,7 +253,7 @@ describe Namespace do
context
'when limit is defined'
do
before
do
namespace
.
plan
=
Namespace
::
GOLD_PLAN
namespace
.
plan
=
create
(
:gold_plan
)
namespace
.
plan
.
update_column
(
:pipeline_size_limit
,
15
)
end
...
...
@@ -482,7 +480,7 @@ describe Namespace do
describe
'#actual_plan'
do
context
'when namespace has a plan associated'
do
before
do
namespace
.
plan
=
Namespace
::
GOLD_PLAN
namespace
.
plan
=
create
(
:gold_plan
)
end
it
'returns an associated plan'
do
...
...
@@ -492,6 +490,10 @@ describe Namespace do
end
context
'when namespace does not have plan associated'
do
before
do
create
(
:free_plan
)
end
it
'returns a free plan object'
do
expect
(
namespace
.
plan
).
to
be_nil
expect
(
namespace
.
actual_plan
.
name
).
to
eq
'free'
...
...
@@ -502,7 +504,7 @@ describe Namespace do
describe
'#actual_plan_name'
do
context
'when namespace has a plan associated'
do
before
do
namespace
.
plan
=
Namespace
::
GOLD_PLAN
namespace
.
plan
=
create
(
:gold_plan
)
end
it
'returns an associated plan name'
do
...
...
spec/ee/spec/models/ee/project_spec.rb
View file @
d20cb5a7
...
...
@@ -174,7 +174,7 @@ describe Project do
context
'allowed by Plan License AND Global License'
do
let
(
:allowed_on_global_license
)
{
true
}
let
(
:plan_license
)
{
Plan
.
find_by
(
name:
'gold'
)
}
let
(
:plan_license
)
{
create
(
:gold_plan
)
}
it
'returns true'
do
is_expected
.
to
eq
(
true
)
...
...
@@ -183,7 +183,7 @@ describe Project do
context
'not allowed by Plan License but project and namespace are public'
do
let
(
:allowed_on_global_license
)
{
true
}
let
(
:plan_license
)
{
Plan
.
find_by
(
name:
'bronze'
)
}
let
(
:plan_license
)
{
create
(
:bronze_plan
)
}
it
'returns true'
do
allow
(
namespace
).
to
receive
(
:public?
)
{
true
}
...
...
@@ -196,7 +196,7 @@ describe Project do
unless
License
.
plan_includes_feature?
(
License
::
STARTER_PLAN
,
feature_sym
)
context
'not allowed by Plan License'
do
let
(
:allowed_on_global_license
)
{
true
}
let
(
:plan_license
)
{
Plan
.
find_by
(
name:
'bronze'
)
}
let
(
:plan_license
)
{
create
(
:bronze_plan
)
}
it
'returns false'
do
is_expected
.
to
eq
(
false
)
...
...
@@ -206,7 +206,7 @@ describe Project do
context
'not allowed by Global License'
do
let
(
:allowed_on_global_license
)
{
false
}
let
(
:plan_license
)
{
Plan
.
find_by
(
name:
'gold'
)
}
let
(
:plan_license
)
{
create
(
:gold_plan
)
}
it
'returns false'
do
is_expected
.
to
eq
(
false
)
...
...
@@ -679,7 +679,7 @@ describe Project do
end
context
'Service Desk available in namespace plan'
do
let
(
:namespace
)
{
create
(
:namespace
,
plan:
Namespace
::
SILVER_PLAN
)
}
let
(
:namespace
)
{
create
(
:namespace
,
plan:
:silver_plan
)
}
it
'is enabled'
do
expect
(
project
.
service_desk_enabled?
).
to
be_truthy
...
...
@@ -1163,7 +1163,7 @@ describe Project do
end
context
'and namespace has a plan'
do
let
(
:namespace
)
{
create
(
:group
,
:private
,
plan:
Namespace
::
BRONZE_PLAN
)
}
let
(
:namespace
)
{
create
(
:group
,
:private
,
plan:
:bronze_plan
)
}
it_behaves_like
'project without disabled services'
end
...
...
spec/ee/spec/services/ee/projects/create_service_spec.rb
View file @
d20cb5a7
...
...
@@ -96,7 +96,8 @@ describe Projects::CreateService, '#execute' do
context
'when licensed on a namespace'
do
it
'allows enabling mirrors'
do
user
.
namespace
.
update!
(
plan:
Plan
.
find_by
(
name:
'gold'
))
plan
=
create
(
:gold_plan
)
user
.
namespace
.
update!
(
plan:
plan
)
project
=
create_project
(
user
,
opts
)
...
...
spec/factories/namespaces.rb
View file @
d20cb5a7
...
...
@@ -28,7 +28,7 @@ FactoryGirl.define do
end
before
:create
do
|
namespace
,
evaluator
|
if
evaluator
.
plan
if
evaluator
.
plan
.
present?
namespace
.
plan
=
create
(
evaluator
.
plan
)
end
end
...
...
spec/features/billings/billing_plans_spec.rb
View file @
d20cb5a7
...
...
@@ -2,7 +2,7 @@ require 'spec_helper'
describe
'Billing plan pages'
,
:feature
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:bronze_plan
)
{
Plan
.
find_by
(
name:
'bronze'
)
}
let
(
:bronze_plan
)
{
create
(
:bronze_plan
)
}
let
(
:plans_data
)
do
[
{
...
...
@@ -141,9 +141,9 @@ describe 'Billing plan pages', :feature do
end
context
'on sub-group'
,
:nested_groups
do
let
(
:group
)
{
create
(
:group
,
plan:
Namespace
::
BRONZE_PLAN
)
}
let
(
:group
)
{
create
(
:group
,
plan:
:bronze_plan
)
}
let!
(
:group_member
)
{
create
(
:group_member
,
:owner
,
group:
group
,
user:
user
)
}
let
(
:subgroup1
)
{
create
(
:group
,
parent:
group
,
plan:
Namespace
::
SILVER_PLAN
)
}
let
(
:subgroup1
)
{
create
(
:group
,
parent:
group
,
plan:
:silver_plan
)
}
let!
(
:subgroup1_member
)
{
create
(
:group_member
,
:owner
,
group:
subgroup1
,
user:
user
)
}
let
(
:subgroup2
)
{
create
(
:group
,
parent:
subgroup1
)
}
let!
(
:subgroup2_member
)
{
create
(
:group_member
,
:owner
,
group:
subgroup2
,
user:
user
)
}
...
...
spec/features/projects/push_rules_spec.rb
View file @
d20cb5a7
...
...
@@ -30,8 +30,8 @@ feature 'Projects > Push Rules', :js do
end
context
'licensed'
do
let
(
:bronze_plan
)
{
Plan
.
find_by!
(
name:
'bronze'
)
}
let
(
:gold_plan
)
{
Plan
.
find_by!
(
name:
'gold'
)
}
let
(
:bronze_plan
)
{
create
(
:bronze_plan
)
}
let
(
:gold_plan
)
{
create
(
:gold_plan
)
}
before
do
stub_licensed_features
(
rule_attr
=>
true
)
...
...
spec/models/project_services/jenkins_deprecated_service_spec.rb
View file @
d20cb5a7
...
...
@@ -165,7 +165,7 @@ eos
end
context
'when namespace has a plan'
do
let
(
:namespace
)
{
create
(
:group
,
:private
,
plan:
Namespace
::
BRONZE_PLAN
)
}
let
(
:namespace
)
{
create
(
:group
,
:private
,
plan:
:bronze_plan
)
}
it_behaves_like
'an enabled jenkins deprecated service'
end
...
...
spec/models/project_services/jenkins_service_spec.rb
View file @
d20cb5a7
...
...
@@ -192,7 +192,7 @@ describe JenkinsService do
end
context
'when namespace has a plan'
do
let
(
:namespace
)
{
create
(
:group
,
:private
,
plan:
Namespace
::
BRONZE_PLAN
)
}
let
(
:namespace
)
{
create
(
:group
,
:private
,
plan:
:bronze_plan
)
}
it
'adds default web hook headers to the request'
do
jenkins_service
.
execute
(
push_sample_data
)
...
...
spec/models/push_rule_spec.rb
View file @
d20cb5a7
...
...
@@ -169,7 +169,7 @@ describe PushRule do
end
context
'with GL.com plans'
do
let
(
:group
)
{
create
(
:group
,
plan:
Plan
.
find_by!
(
name:
gl_plan
)
)
}
let
(
:group
)
{
create
(
:group
,
plan:
plan
)
}
let
(
:project
)
{
create
(
:project
,
namespace:
group
)
}
let
(
:push_rule
)
{
create
(
:push_rule
,
project:
project
)
}
...
...
@@ -179,19 +179,19 @@ describe PushRule do
end
context
'with a Bronze plan'
do
let
(
:
gl_plan
)
{
::
EE
::
Namespace
::
BRONZE_PLAN
}
let
(
:
plan
)
{
:bronze_plan
}
it_behaves_like
'an unavailable push_rule'
end
context
'with a Silver plan'
do
let
(
:
gl_plan
)
{
::
EE
::
Namespace
::
SILVER_PLAN
}
let
(
:
plan
)
{
:silver_plan
}
it_behaves_like
'an available push_rule'
end
context
'with a Gold plan'
do
let
(
:
gl_plan
)
{
::
EE
::
Namespace
::
GOLD_PLAN
}
let
(
:
plan
)
{
:gold_plan
}
it_behaves_like
'an available push_rule'
end
...
...
spec/requests/api/namespaces_spec.rb
View file @
d20cb5a7
...
...
@@ -95,6 +95,10 @@ describe API::Namespaces do
end
describe
'PUT /namespaces/:id'
do
before
do
create
(
:silver_plan
)
end
context
'when authenticated as admin'
do
it
'updates namespace using full_path'
do
put
api
(
"/namespaces/
#{
group1
.
full_path
}
"
,
admin
),
plan:
'silver'
,
shared_runners_minutes_limit:
9001
...
...
spec/requests/api/v3/github_spec.rb
View file @
d20cb5a7
...
...
@@ -75,7 +75,7 @@ describe API::V3::Github do
end
it
'filters unlicensed namespace projects'
do
silver_plan
=
Plan
.
find_by!
(
name:
'silver'
)
silver_plan
=
create
(
:silver_plan
)
licensed_project
=
create
(
:project
,
:empty_repo
)
licensed_project
.
add_reporter
(
user
)
licensed_project
.
namespace
.
update!
(
plan_id:
silver_plan
.
id
)
...
...
spec/workers/update_all_mirrors_worker_spec.rb
View file @
d20cb5a7
...
...
@@ -60,7 +60,7 @@ describe UpdateAllMirrorsWorker do
context
'licensed'
do
def
scheduled_mirror
(
at
:,
licensed
:)
namespace
=
create
(
:group
,
:public
,
plan:
(
Namespace
::
BRONZE_PLAN
if
licensed
))
namespace
=
create
(
:group
,
:public
,
plan:
(
:bronze_plan
if
licensed
))
project
=
create
(
:project
,
:public
,
:mirror
,
namespace:
namespace
)
project
.
mirror_data
.
update!
(
next_execution_timestamp:
at
)
...
...
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