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
4a1654ed
Commit
4a1654ed
authored
Jan 16, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace context with service in specs
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
1d2bdb4d
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
19 additions
and
19 deletions
+19
-19
spec/models/forked_project_link_spec.rb
spec/models/forked_project_link_spec.rb
+1
-1
spec/services/fork_service_spec.rb
spec/services/fork_service_spec.rb
+2
-2
spec/services/issues/bulk_update_context_spec.rb
spec/services/issues/bulk_update_context_spec.rb
+6
-6
spec/services/projects_create_service_spec.rb
spec/services/projects_create_service_spec.rb
+2
-2
spec/services/projects_update_service_spec.rb
spec/services/projects_update_service_spec.rb
+3
-3
spec/services/search_service_spec.rb
spec/services/search_service_spec.rb
+5
-5
No files found.
spec/models/forked_project_link_spec.rb
View file @
4a1654ed
...
...
@@ -58,7 +58,7 @@ describe :forked_from_project do
end
def
fork_project
(
from_project
,
user
)
context
=
Projects
::
Fork
Context
.
new
(
from_project
,
user
)
context
=
Projects
::
Fork
Service
.
new
(
from_project
,
user
)
shell
=
double
(
"gitlab_shell"
)
shell
.
stub
(
fork_repository:
true
)
context
.
stub
(
gitlab_shell:
shell
)
...
...
spec/
contexts/fork_context
_spec.rb
→
spec/
services/fork_service
_spec.rb
View file @
4a1654ed
require
'spec_helper'
describe
Projects
::
Fork
Context
do
describe
Projects
::
Fork
Service
do
describe
:fork_by_user
do
before
do
@from_namespace
=
create
(
:namespace
)
...
...
@@ -47,7 +47,7 @@ describe Projects::ForkContext do
end
def
fork_project
(
from_project
,
user
,
fork_success
=
true
)
context
=
Projects
::
Fork
Context
.
new
(
from_project
,
user
)
context
=
Projects
::
Fork
Service
.
new
(
from_project
,
user
)
shell
=
double
(
"gitlab_shell"
)
shell
.
stub
(
fork_repository:
fork_success
)
context
.
stub
(
gitlab_shell:
shell
)
...
...
spec/
context
s/issues/bulk_update_context_spec.rb
→
spec/
service
s/issues/bulk_update_context_spec.rb
View file @
4a1654ed
require
'spec_helper'
describe
Issues
::
BulkUpdate
Context
do
describe
Issues
::
BulkUpdate
Service
do
before
(
:each
)
{
ActiveRecord
::
Base
.
observers
.
enable
(
:user_observer
)
}
after
(
:each
)
{
ActiveRecord
::
Base
.
observers
.
disable
(
:user_observer
)
}
...
...
@@ -14,7 +14,7 @@ describe Issues::BulkUpdateContext do
name:
"GitLab"
,
namespace:
@user
.
namespace
}
@project
=
Projects
::
Create
Context
.
new
(
@user
,
opts
).
execute
@project
=
Projects
::
Create
Service
.
new
(
@user
,
opts
).
execute
end
describe
:close_issue
do
...
...
@@ -32,7 +32,7 @@ describe Issues::BulkUpdateContext do
end
it
{
result
=
Issues
::
BulkUpdate
Context
.
new
(
@project
,
@user
,
@params
).
execute
result
=
Issues
::
BulkUpdate
Service
.
new
(
@project
,
@user
,
@params
).
execute
result
[
:success
].
should
be_true
result
[
:count
].
should
==
@issues
.
count
...
...
@@ -57,7 +57,7 @@ describe Issues::BulkUpdateContext do
end
it
{
result
=
Issues
::
BulkUpdate
Context
.
new
(
@project
,
@user
,
@params
).
execute
result
=
Issues
::
BulkUpdate
Service
.
new
(
@project
,
@user
,
@params
).
execute
result
[
:success
].
should
be_true
result
[
:count
].
should
==
@issues
.
count
...
...
@@ -80,7 +80,7 @@ describe Issues::BulkUpdateContext do
end
it
{
result
=
Issues
::
BulkUpdate
Context
.
new
(
@project
,
@user
,
@params
).
execute
result
=
Issues
::
BulkUpdate
Service
.
new
(
@project
,
@user
,
@params
).
execute
result
[
:success
].
should
be_true
result
[
:count
].
should
==
1
...
...
@@ -102,7 +102,7 @@ describe Issues::BulkUpdateContext do
end
it
{
result
=
Issues
::
BulkUpdate
Context
.
new
(
@project
,
@user
,
@params
).
execute
result
=
Issues
::
BulkUpdate
Service
.
new
(
@project
,
@user
,
@params
).
execute
result
[
:success
].
should
be_true
result
[
:count
].
should
==
1
...
...
spec/
contexts/projects_create_context
_spec.rb
→
spec/
services/projects_create_service
_spec.rb
View file @
4a1654ed
require
'spec_helper'
describe
Projects
::
Create
Context
do
describe
Projects
::
Create
Service
do
before
(
:each
)
{
ActiveRecord
::
Base
.
observers
.
enable
(
:user_observer
)
}
after
(
:each
)
{
ActiveRecord
::
Base
.
observers
.
disable
(
:user_observer
)
}
...
...
@@ -136,7 +136,7 @@ describe Projects::CreateContext do
end
def
create_project
(
user
,
opts
)
Projects
::
Create
Context
.
new
(
user
,
opts
).
execute
Projects
::
Create
Service
.
new
(
user
,
opts
).
execute
end
end
spec/
contexts/projects_update_context
_spec.rb
→
spec/
services/projects_update_service
_spec.rb
View file @
4a1654ed
require
'spec_helper'
describe
Projects
::
Update
Context
do
describe
Projects
::
Update
Service
do
before
(
:each
)
{
ActiveRecord
::
Base
.
observers
.
enable
(
:user_observer
)
}
after
(
:each
)
{
ActiveRecord
::
Base
.
observers
.
disable
(
:user_observer
)
}
...
...
@@ -106,6 +106,6 @@ describe Projects::UpdateContext do
end
def
update_project
(
project
,
user
,
opts
)
Projects
::
Update
Context
.
new
(
project
,
user
,
opts
).
execute
Projects
::
Update
Service
.
new
(
project
,
user
,
opts
).
execute
end
end
\ No newline at end of file
end
spec/
contexts/search_context
_spec.rb
→
spec/
services/search_service
_spec.rb
View file @
4a1654ed
require
'spec_helper'
describe
'Search::Global
Context
'
do
describe
'Search::Global
Service
'
do
let
(
:found_namespace
)
{
create
(
:namespace
,
name:
'searchable namespace'
,
path
:'another_thing'
)
}
let
(
:user
)
{
create
(
:user
,
namespace:
found_namespace
)
}
let!
(
:found_project
)
{
create
(
:project
,
name:
'searchable_project'
,
creator_id:
user
.
id
,
namespace:
found_namespace
,
visibility_level:
Gitlab
::
VisibilityLevel
::
PRIVATE
)
}
...
...
@@ -19,7 +19,7 @@ describe 'Search::GlobalContext' do
describe
'#execute'
do
context
'unauthenticated'
do
it
'should return public projects only'
do
context
=
Search
::
Global
Context
.
new
(
nil
,
search:
"searchable"
)
context
=
Search
::
Global
Service
.
new
(
nil
,
search:
"searchable"
)
results
=
context
.
execute
results
[
:projects
].
should
have
(
1
).
items
results
[
:projects
].
should
include
(
public_project
)
...
...
@@ -28,7 +28,7 @@ describe 'Search::GlobalContext' do
context
'authenticated'
do
it
'should return public, internal and private projects'
do
context
=
Search
::
Global
Context
.
new
(
user
,
search:
"searchable"
)
context
=
Search
::
Global
Service
.
new
(
user
,
search:
"searchable"
)
results
=
context
.
execute
results
[
:projects
].
should
have
(
3
).
items
results
[
:projects
].
should
include
(
public_project
)
...
...
@@ -37,7 +37,7 @@ describe 'Search::GlobalContext' do
end
it
'should return only public & internal projects'
do
context
=
Search
::
Global
Context
.
new
(
internal_user
,
search:
"searchable"
)
context
=
Search
::
Global
Service
.
new
(
internal_user
,
search:
"searchable"
)
results
=
context
.
execute
results
[
:projects
].
should
have
(
2
).
items
results
[
:projects
].
should
include
(
internal_project
)
...
...
@@ -45,7 +45,7 @@ describe 'Search::GlobalContext' do
end
it
'namespace name should be searchable'
do
context
=
Search
::
Global
Context
.
new
(
user
,
search:
"searchable namespace"
)
context
=
Search
::
Global
Service
.
new
(
user
,
search:
"searchable namespace"
)
results
=
context
.
execute
results
[
:projects
].
should
==
[
found_project
]
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