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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
20fc42e9
Commit
20fc42e9
authored
Oct 10, 2017
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve post_receive spec by not stubbing private methods
parent
9ad48a74
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
5 deletions
+7
-5
spec/workers/post_receive_spec.rb
spec/workers/post_receive_spec.rb
+7
-5
No files found.
spec/workers/post_receive_spec.rb
View file @
20fc42e9
...
@@ -66,19 +66,21 @@ describe PostReceive do
...
@@ -66,19 +66,21 @@ describe PostReceive do
end
end
context
"gitlab-ci.yml"
do
context
"gitlab-ci.yml"
do
let
(
:changes
)
{
"123456 789012 refs/heads/feature
\n
654321 210987 refs/tags/tag"
}
subject
{
described_class
.
new
.
perform
(
gl_repository
,
key_id
,
base64_changes
)
}
subject
{
described_class
.
new
.
perform
(
gl_repository
,
key_id
,
base64_changes
)
}
context
"creates a Ci::Pipeline for every change"
do
context
"creates a Ci::Pipeline for every change"
do
before
do
before
do
stub_ci_pipeline_to_return_yaml_file
stub_ci_pipeline_to_return_yaml_file
# TODO, don't stub private methods
allow_any_instance_of
(
Project
)
#
.
to
receive
(
:commit
)
allow_any_instance_of
(
Ci
::
CreatePipelineService
)
.
and_return
(
project
.
commit
)
.
to
receive
(
:commit
).
and_return
(
OpenStruct
.
new
(
id:
'123456'
))
allow_any_instance_of
(
Repository
)
allow_any_instance_of
(
Repository
)
.
to
receive
(
:branch_exists?
).
and_return
(
true
)
.
to
receive
(
:branch_exists?
)
.
and_return
(
true
)
end
end
it
{
expect
{
subject
}.
to
change
{
Ci
::
Pipeline
.
count
}.
by
(
2
)
}
it
{
expect
{
subject
}.
to
change
{
Ci
::
Pipeline
.
count
}.
by
(
2
)
}
...
...
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