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
61e520e0
Commit
61e520e0
authored
Jul 06, 2017
by
Nick Thomas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix conflicts in Project model and specs by moving code to EE module
parent
94ab1e1f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
39 additions
and
52 deletions
+39
-52
app/models/ee/project.rb
app/models/ee/project.rb
+4
-0
app/models/project.rb
app/models/project.rb
+0
-6
spec/models/ee/project_spec.rb
spec/models/ee/project_spec.rb
+35
-0
spec/models/project_spec.rb
spec/models/project_spec.rb
+0
-46
No files found.
app/models/ee/project.rb
View file @
61e520e0
...
...
@@ -36,6 +36,10 @@ module EE
has_many
:remote_mirrors
,
inverse_of: :project
has_many
:path_locks
has_many
:sourced_pipelines
,
class_name:
'Ci::Sources::Pipeline'
,
foreign_key: :source_project_id
has_many
:source_pipelines
,
class_name:
'Ci::Sources::Pipeline'
,
foreign_key: :project_id
scope
:with_shared_runners_limit_enabled
,
->
{
with_shared_runners
.
non_public_only
}
scope
:mirrors_to_sync
,
->
do
...
...
app/models/project.rb
View file @
61e520e0
...
...
@@ -186,13 +186,7 @@ class Project < ActiveRecord::Base
has_many
:environments
has_many
:deployments
has_many
:pipeline_schedules
,
class_name:
'Ci::PipelineSchedule'
<<<<<<<
HEAD
has_many
:sourced_pipelines
,
class_name:
Ci
::
Sources
::
Pipeline
,
foreign_key: :source_project_id
=======
>>>>>>>
ce
/
master
has_many
:source_pipelines
,
class_name:
Ci
::
Sources
::
Pipeline
,
foreign_key: :project_id
has_many
:active_runners
,
->
{
active
},
through: :runner_projects
,
source: :runner
,
class_name:
'Ci::Runner'
accepts_nested_attributes_for
:variables
,
allow_destroy:
true
...
...
spec/models/ee/project_spec.rb
View file @
61e520e0
...
...
@@ -9,6 +9,11 @@ describe Project, models: true do
it
{
is_expected
.
to
delegate_method
(
:actual_shared_runners_minutes_limit
).
to
(
:namespace
)
}
it
{
is_expected
.
to
delegate_method
(
:shared_runners_minutes_limit_enabled?
).
to
(
:namespace
)
}
it
{
is_expected
.
to
delegate_method
(
:shared_runners_minutes_used?
).
to
(
:namespace
)
}
it
{
is_expected
.
to
have_one
(
:mirror_data
).
class_name
(
'ProjectMirrorData'
)
}
it
{
is_expected
.
to
have_many
(
:path_locks
)
}
it
{
is_expected
.
to
have_many
(
:sourced_pipelines
)
}
it
{
is_expected
.
to
have_many
(
:source_pipelines
)
}
end
describe
'#push_rule'
do
...
...
@@ -55,6 +60,36 @@ describe Project, models: true do
end
end
describe
'#execute_hooks'
do
it
"triggers project and group hooks"
do
group
=
create
:group
,
name:
'gitlab'
project
=
create
(
:project
,
name:
'gitlabhq'
,
namespace:
group
)
project_hook
=
create
(
:project_hook
,
push_events:
true
,
project:
project
)
group_hook
=
create
(
:group_hook
,
push_events:
true
,
group:
group
)
stub_request
(
:post
,
project_hook
.
url
)
stub_request
(
:post
,
group_hook
.
url
)
expect_any_instance_of
(
GroupHook
).
to
receive
(
:async_execute
).
and_return
(
true
)
expect_any_instance_of
(
ProjectHook
).
to
receive
(
:async_execute
).
and_return
(
true
)
project
.
execute_hooks
({},
:push_hooks
)
end
end
describe
'#allowed_to_share_with_group?'
do
let
(
:project
)
{
create
(
:project
)
}
it
"returns true"
do
expect
(
project
.
allowed_to_share_with_group?
).
to
be_truthy
end
it
"returns false"
do
project
.
namespace
.
update
(
share_with_group_lock:
true
)
expect
(
project
.
allowed_to_share_with_group?
).
to
be_falsey
end
end
describe
'#feature_available?'
do
let
(
:namespace
)
{
build_stubbed
(
:namespace
)
}
let
(
:project
)
{
build_stubbed
(
:project
,
namespace:
namespace
)
}
...
...
spec/models/project_spec.rb
View file @
61e520e0
...
...
@@ -51,10 +51,6 @@ describe Project, models: true do
it
{
is_expected
.
to
have_one
(
:project_feature
)
}
it
{
is_expected
.
to
have_one
(
:statistics
).
class_name
(
'ProjectStatistics'
)
}
it
{
is_expected
.
to
have_one
(
:import_data
).
class_name
(
'ProjectImportData'
)
}
<<<<<<<
HEAD
it
{
is_expected
.
to
have_one
(
:mirror_data
).
class_name
(
'ProjectMirrorData'
)
}
=======
>>>>>>>
ce
/
master
it
{
is_expected
.
to
have_one
(
:last_event
).
class_name
(
'Event'
)
}
it
{
is_expected
.
to
have_one
(
:forked_from_project
).
through
(
:forked_project_link
)
}
it
{
is_expected
.
to
have_many
(
:commit_statuses
)
}
...
...
@@ -66,10 +62,6 @@ describe Project, models: true do
it
{
is_expected
.
to
have_many
(
:variables
)
}
it
{
is_expected
.
to
have_many
(
:triggers
)
}
it
{
is_expected
.
to
have_many
(
:pages_domains
)
}
<<<<<<<
HEAD
it
{
is_expected
.
to
have_many
(
:path_locks
)
}
=======
>>>>>>>
ce
/
master
it
{
is_expected
.
to
have_many
(
:labels
).
class_name
(
'ProjectLabel'
)
}
it
{
is_expected
.
to
have_many
(
:users_star_projects
)
}
it
{
is_expected
.
to
have_many
(
:environments
)
}
...
...
@@ -83,11 +75,6 @@ describe Project, models: true do
it
{
is_expected
.
to
have_many
(
:approver_groups
).
dependent
(
:destroy
)
}
it
{
is_expected
.
to
have_many
(
:uploads
).
dependent
(
:destroy
)
}
it
{
is_expected
.
to
have_many
(
:pipeline_schedules
)
}
<<<<<<<
HEAD
it
{
is_expected
.
to
have_many
(
:sourced_pipelines
)
}
it
{
is_expected
.
to
have_many
(
:source_pipelines
)
}
=======
>>>>>>>
ce
/
master
context
'after initialized'
do
it
"has a project_feature"
do
...
...
@@ -1028,39 +1015,6 @@ describe Project, models: true do
let
(
:project
)
{
create
(
:empty_project
)
}
it
{
is_expected
.
to
eq
nil
}
<<<<<<<
HEAD
end
end
describe
'#execute_hooks'
do
it
"triggers project and group hooks"
do
group
=
create
:group
,
name:
'gitlab'
project
=
create
(
:project
,
name:
'gitlabhq'
,
namespace:
group
)
project_hook
=
create
(
:project_hook
,
push_events:
true
,
project:
project
)
group_hook
=
create
(
:group_hook
,
push_events:
true
,
group:
group
)
stub_request
(
:post
,
project_hook
.
url
)
stub_request
(
:post
,
group_hook
.
url
)
expect_any_instance_of
(
GroupHook
).
to
receive
(
:async_execute
).
and_return
(
true
)
expect_any_instance_of
(
ProjectHook
).
to
receive
(
:async_execute
).
and_return
(
true
)
project
.
execute_hooks
({},
:push_hooks
)
end
end
describe
'#allowed_to_share_with_group?'
do
let
(
:project
)
{
create
(
:project
)
}
it
"returns true"
do
expect
(
project
.
allowed_to_share_with_group?
).
to
be_truthy
end
it
"returns false"
do
project
.
namespace
.
update
(
share_with_group_lock:
true
)
expect
(
project
.
allowed_to_share_with_group?
).
to
be_falsey
=======
>>>>>>>
ce
/
master
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