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
0a2649ce
Commit
0a2649ce
authored
Sep 21, 2016
by
Timothy Andrew
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix build.
parent
b5dc0c6d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
8 deletions
+8
-8
spec/models/ci/pipeline_spec.rb
spec/models/ci/pipeline_spec.rb
+3
-3
spec/services/create_deployment_service_spec.rb
spec/services/create_deployment_service_spec.rb
+3
-3
spec/services/git_push_service_spec.rb
spec/services/git_push_service_spec.rb
+2
-2
No files found.
spec/models/ci/pipeline_spec.rb
View file @
0a2649ce
...
@@ -197,13 +197,13 @@ describe Ci::Pipeline, models: true do
...
@@ -197,13 +197,13 @@ describe Ci::Pipeline, models: true do
time
=
Time
.
now
time
=
Time
.
now
Timecop
.
freeze
(
time
)
{
build
.
run
}
Timecop
.
freeze
(
time
)
{
build
.
run
}
expect
(
merge_request
.
metrics
.
latest_build_started_at
).
to
be_within
(
1
.
second
).
of
(
time
)
expect
(
merge_request
.
reload
.
metrics
.
latest_build_started_at
).
to
be_within
(
1
.
second
).
of
(
time
)
end
end
it
'clears the build end time'
do
it
'clears the build end time'
do
build
.
run
build
.
run
expect
(
merge_request
.
metrics
.
latest_build_finished_at
).
to
be_nil
expect
(
merge_request
.
reload
.
metrics
.
latest_build_finished_at
).
to
be_nil
end
end
end
end
...
@@ -213,7 +213,7 @@ describe Ci::Pipeline, models: true do
...
@@ -213,7 +213,7 @@ describe Ci::Pipeline, models: true do
time
=
Time
.
now
time
=
Time
.
now
Timecop
.
freeze
(
time
)
{
build
.
success
}
Timecop
.
freeze
(
time
)
{
build
.
success
}
expect
(
merge_request
.
metrics
.
latest_build_finished_at
).
to
be_within
(
1
.
second
).
of
(
time
)
expect
(
merge_request
.
reload
.
metrics
.
latest_build_finished_at
).
to
be_within
(
1
.
second
).
of
(
time
)
end
end
end
end
end
end
...
...
spec/services/create_deployment_service_spec.rb
View file @
0a2649ce
...
@@ -190,7 +190,7 @@ describe CreateDeploymentService, services: true do
...
@@ -190,7 +190,7 @@ describe CreateDeploymentService, services: true do
time
=
Time
.
now
time
=
Time
.
now
Timecop
.
freeze
(
time
)
{
service
.
execute
}
Timecop
.
freeze
(
time
)
{
service
.
execute
}
expect
(
merge_request
.
metrics
.
first_deployed_to_production_at
).
to
be_within
(
1
.
second
).
of
(
time
)
expect
(
merge_request
.
reload
.
metrics
.
first_deployed_to_production_at
).
to
be_within
(
1
.
second
).
of
(
time
)
end
end
it
"doesn't set the time if the deploy's environment is not 'production'"
do
it
"doesn't set the time if the deploy's environment is not 'production'"
do
...
@@ -198,7 +198,7 @@ describe CreateDeploymentService, services: true do
...
@@ -198,7 +198,7 @@ describe CreateDeploymentService, services: true do
service
=
described_class
.
new
(
project
,
user
,
staging_params
)
service
=
described_class
.
new
(
project
,
user
,
staging_params
)
service
.
execute
service
.
execute
expect
(
merge_request
.
metrics
.
first_deployed_to_production_at
).
to
be_nil
expect
(
merge_request
.
reload
.
metrics
.
first_deployed_to_production_at
).
to
be_nil
end
end
it
'does not raise errors if the merge request does not have a metrics record'
do
it
'does not raise errors if the merge request does not have a metrics record'
do
...
@@ -231,7 +231,7 @@ describe CreateDeploymentService, services: true do
...
@@ -231,7 +231,7 @@ describe CreateDeploymentService, services: true do
# Previous deploy
# Previous deploy
time
=
Time
.
now
time
=
Time
.
now
Timecop
.
freeze
(
time
)
{
service
.
execute
}
Timecop
.
freeze
(
time
)
{
service
.
execute
}
merge_request
.
metrics
.
update
(
first_deployed_to_production_at:
nil
)
merge_request
.
reload
.
metrics
.
update
(
first_deployed_to_production_at:
nil
)
expect
(
merge_request
.
reload
.
metrics
.
first_deployed_to_production_at
).
to
be_nil
expect
(
merge_request
.
reload
.
metrics
.
first_deployed_to_production_at
).
to
be_nil
...
...
spec/services/git_push_service_spec.rb
View file @
0a2649ce
...
@@ -364,14 +364,14 @@ describe GitPushService, services: true do
...
@@ -364,14 +364,14 @@ describe GitPushService, services: true do
it
'sets the metric for referenced issues'
do
it
'sets the metric for referenced issues'
do
execute_service
(
project
,
user
,
@oldrev
,
@newrev
,
@ref
)
execute_service
(
project
,
user
,
@oldrev
,
@newrev
,
@ref
)
expect
(
issue
.
metrics
.
first_mentioned_in_commit_at
).
to
be_within
(
1
.
second
).
of
(
commit_time
)
expect
(
issue
.
reload
.
metrics
.
first_mentioned_in_commit_at
).
to
be_within
(
1
.
second
).
of
(
commit_time
)
end
end
it
'does not set the metric for non-referenced issues'
do
it
'does not set the metric for non-referenced issues'
do
non_referenced_issue
=
create
(
:issue
,
project:
project
)
non_referenced_issue
=
create
(
:issue
,
project:
project
)
execute_service
(
project
,
user
,
@oldrev
,
@newrev
,
@ref
)
execute_service
(
project
,
user
,
@oldrev
,
@newrev
,
@ref
)
expect
(
non_referenced_issue
.
metrics
.
first_mentioned_in_commit_at
).
to
be_nil
expect
(
non_referenced_issue
.
reload
.
metrics
.
first_mentioned_in_commit_at
).
to
be_nil
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