BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
e109166d
Commit
e109166d
authored
Sep 20, 2016
by
Timothy Andrew
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix spec failures.
parent
8747f29d
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
16 additions
and
12 deletions
+16
-12
merge_request.rb
app/models/merge_request.rb
+5
-1
pipeline_spec.rb
spec/models/ci/pipeline_spec.rb
+2
-2
metrics_spec.rb
spec/models/issue/metrics_spec.rb
+4
-4
metrics_spec.rb
spec/models/merge_request/metrics_spec.rb
+1
-1
create_deployment_service_spec.rb
spec/services/create_deployment_service_spec.rb
+3
-3
git_push_service_spec.rb
spec/services/git_push_service_spec.rb
+1
-1
No files found.
app/models/merge_request.rb
View file @
e109166d
...
@@ -527,7 +527,11 @@ class MergeRequest < ActiveRecord::Base
...
@@ -527,7 +527,11 @@ class MergeRequest < ActiveRecord::Base
# Return the set of issues that will be closed if this merge request is accepted.
# Return the set of issues that will be closed if this merge request is accepted.
def
closes_issues
(
current_user
=
self
.
author
)
def
closes_issues
(
current_user
=
self
.
author
)
if
target_branch
==
project
.
default_branch
if
target_branch
==
project
.
default_branch
messages
=
commits
.
map
(
&
:safe_message
)
<<
description
messages
=
if
merge_request_diff
commits
.
map
(
&
:safe_message
)
<<
description
else
[
description
]
end
Gitlab
::
ClosingIssueExtractor
.
new
(
project
,
current_user
).
Gitlab
::
ClosingIssueExtractor
.
new
(
project
,
current_user
).
closed_by_message
(
messages
.
join
(
"
\n
"
))
closed_by_message
(
messages
.
join
(
"
\n
"
))
...
...
spec/models/ci/pipeline_spec.rb
View file @
e109166d
...
@@ -197,7 +197,7 @@ describe Ci::Pipeline, models: true do
...
@@ -197,7 +197,7 @@ 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
eq
(
time
)
expect
(
merge_request
.
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
...
@@ -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
eq
(
time
)
expect
(
merge_request
.
metrics
.
latest_build_finished_at
).
to
be_within
(
1
.
second
).
of
(
time
)
end
end
end
end
end
end
...
...
spec/models/issue/metrics_spec.rb
View file @
e109166d
...
@@ -13,7 +13,7 @@ describe Issue::Metrics, models: true do
...
@@ -13,7 +13,7 @@ describe Issue::Metrics, models: true do
metrics
=
subject
.
metrics
metrics
=
subject
.
metrics
expect
(
metrics
).
to
be_present
expect
(
metrics
).
to
be_present
expect
(
metrics
.
first_associated_with_milestone_at
).
to
eq
(
time
)
expect
(
metrics
.
first_associated_with_milestone_at
).
to
be_within
(
1
.
second
).
of
(
time
)
end
end
it
"does not record the second time an issue is associated with a milestone"
do
it
"does not record the second time an issue is associated with a milestone"
do
...
@@ -24,7 +24,7 @@ describe Issue::Metrics, models: true do
...
@@ -24,7 +24,7 @@ describe Issue::Metrics, models: true do
metrics
=
subject
.
metrics
metrics
=
subject
.
metrics
expect
(
metrics
).
to
be_present
expect
(
metrics
).
to
be_present
expect
(
metrics
.
first_associated_with_milestone_at
).
to
eq
(
time
)
expect
(
metrics
.
first_associated_with_milestone_at
).
to
be_within
(
1
.
second
).
of
(
time
)
end
end
end
end
...
@@ -36,7 +36,7 @@ describe Issue::Metrics, models: true do
...
@@ -36,7 +36,7 @@ describe Issue::Metrics, models: true do
metrics
=
subject
.
metrics
metrics
=
subject
.
metrics
expect
(
metrics
).
to
be_present
expect
(
metrics
).
to
be_present
expect
(
metrics
.
first_added_to_board_at
).
to
eq
(
time
)
expect
(
metrics
.
first_added_to_board_at
).
to
be_within
(
1
.
second
).
of
(
time
)
end
end
it
"does not record the second time an issue is associated with a list label"
do
it
"does not record the second time an issue is associated with a list label"
do
...
@@ -48,7 +48,7 @@ describe Issue::Metrics, models: true do
...
@@ -48,7 +48,7 @@ describe Issue::Metrics, models: true do
metrics
=
subject
.
metrics
metrics
=
subject
.
metrics
expect
(
metrics
).
to
be_present
expect
(
metrics
).
to
be_present
expect
(
metrics
.
first_added_to_board_at
).
to
eq
(
time
)
expect
(
metrics
.
first_added_to_board_at
).
to
be_within
(
1
.
second
).
of
(
time
)
end
end
end
end
end
end
...
...
spec/models/merge_request/metrics_spec.rb
View file @
e109166d
...
@@ -12,7 +12,7 @@ describe MergeRequest::Metrics, models: true do
...
@@ -12,7 +12,7 @@ describe MergeRequest::Metrics, models: true do
metrics
=
subject
.
metrics
metrics
=
subject
.
metrics
expect
(
metrics
).
to
be_present
expect
(
metrics
).
to
be_present
expect
(
metrics
.
merged_at
).
to
eq
(
time
)
expect
(
metrics
.
merged_at
).
to
be_within
(
1
.
second
).
of
(
time
)
end
end
end
end
end
end
spec/services/create_deployment_service_spec.rb
View file @
e109166d
...
@@ -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
eq
(
time
)
expect
(
merge_request
.
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
...
@@ -216,13 +216,13 @@ describe CreateDeploymentService, services: true do
...
@@ -216,13 +216,13 @@ describe CreateDeploymentService, services: true do
time
=
Time
.
now
time
=
Time
.
now
Timecop
.
freeze
(
time
)
{
service
.
execute
}
Timecop
.
freeze
(
time
)
{
service
.
execute
}
expect
(
merge_request
.
reload
.
metrics
.
first_deployed_to_production_at
).
to
eq
(
time
)
expect
(
merge_request
.
reload
.
metrics
.
first_deployed_to_production_at
).
to
be_within
(
1
.
second
).
of
(
time
)
# Current deploy
# Current deploy
service
=
described_class
.
new
(
project
,
user
,
params
)
service
=
described_class
.
new
(
project
,
user
,
params
)
Timecop
.
freeze
(
time
+
12
.
hours
)
{
service
.
execute
}
Timecop
.
freeze
(
time
+
12
.
hours
)
{
service
.
execute
}
expect
(
merge_request
.
reload
.
metrics
.
first_deployed_to_production_at
).
to
eq
(
time
)
expect
(
merge_request
.
reload
.
metrics
.
first_deployed_to_production_at
).
to
be_within
(
1
.
second
).
of
(
time
)
end
end
end
end
...
...
spec/services/git_push_service_spec.rb
View file @
e109166d
...
@@ -364,7 +364,7 @@ describe GitPushService, services: true do
...
@@ -364,7 +364,7 @@ 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
eq
(
commit_time
)
expect
(
issue
.
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
...
...
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