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
# Return the set of issues that will be closed if this merge request is accepted.
def
closes_issues
(
current_user
=
self
.
author
)
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
).
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
time
=
Time
.
now
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
it
'clears the build end time'
do
...
...
@@ -213,7 +213,7 @@ describe Ci::Pipeline, models: true do
time
=
Time
.
now
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
...
...
spec/models/issue/metrics_spec.rb
View file @
e109166d
...
...
@@ -13,7 +13,7 @@ describe Issue::Metrics, models: true do
metrics
=
subject
.
metrics
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
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
metrics
=
subject
.
metrics
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
...
...
@@ -36,7 +36,7 @@ describe Issue::Metrics, models: true do
metrics
=
subject
.
metrics
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
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
metrics
=
subject
.
metrics
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
...
...
spec/models/merge_request/metrics_spec.rb
View file @
e109166d
...
...
@@ -12,7 +12,7 @@ describe MergeRequest::Metrics, models: true do
metrics
=
subject
.
metrics
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
spec/services/create_deployment_service_spec.rb
View file @
e109166d
...
...
@@ -190,7 +190,7 @@ describe CreateDeploymentService, services: true do
time
=
Time
.
now
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
it
"doesn't set the time if the deploy's environment is not 'production'"
do
...
...
@@ -216,13 +216,13 @@ describe CreateDeploymentService, services: true do
time
=
Time
.
now
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
service
=
described_class
.
new
(
project
,
user
,
params
)
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
...
...
spec/services/git_push_service_spec.rb
View file @
e109166d
...
...
@@ -364,7 +364,7 @@ describe GitPushService, services: true do
it
'sets the metric for referenced issues'
do
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
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