codeclimate-services 1.9.2 → 1.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/cc/presenters/pull_requests_presenter.rb +7 -27
- data/lib/cc/services/version.rb +1 -1
- data/spec/cc/presenters/pull_requests_presenter_spec.rb +10 -5
- data/spec/cc/service/github_pull_requests_spec.rb +3 -3
- data/spec/cc/service/gitlab_merge_requests_spec.rb +2 -2
- data/spec/cc/service/stash_pull_requests_spec.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ed9a5c4b56c617ffde12f689f9f42633735c6d93
|
4
|
+
data.tar.gz: 623c26772ad31e593ab6f75f15f29145a065bc24
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9f159c9c3527889b527fdf1d2172adb0743e83ddb937e69496b7d1b639d405bffd3365aea93a8e1abf527102a73c2a7f5092c5cd3c059194641ca910789dc964
|
7
|
+
data.tar.gz: 0a51db3bc18c327aa409b4fb3f2b1d42c20156c35366fd1469e5aa3cfab583a56d098e8159a218d88779261657017ae2ff2f4bbcf31695ac19517eee9693cf0e
|
@@ -40,42 +40,22 @@ module CC
|
|
40
40
|
end
|
41
41
|
|
42
42
|
def success_message
|
43
|
-
if
|
44
|
-
"
|
43
|
+
if @new_count > 0 && @fixed_count > 0
|
44
|
+
"#{@new_count} new #{"issue".pluralize(@new_count)} (#{@fixed_count} fixed)"
|
45
|
+
elsif @new_count <= 0 && @fixed_count > 0
|
46
|
+
"#{@fixed_count} fixed #{"issue".pluralize(@fixed_count)}"
|
47
|
+
elsif @new_count > 0 && @fixed_count <= 0
|
48
|
+
"#{@new_count} new #{"issue".pluralize(@new_count)}"
|
45
49
|
else
|
46
|
-
"
|
50
|
+
"no new or fixed issues"
|
47
51
|
end
|
48
52
|
end
|
49
53
|
|
50
54
|
private
|
51
55
|
|
52
|
-
def both_issue_counts_zero?
|
53
|
-
issue_counts.all?(&:zero?)
|
54
|
-
end
|
55
|
-
|
56
|
-
def formatted_fixed_issues
|
57
|
-
if @fixed_count > 0
|
58
|
-
"#{number_to_delimited(@fixed_count)} fixed #{"issue".pluralize(@fixed_count)}"
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
def formatted_new_issues
|
63
|
-
if @new_count > 0
|
64
|
-
"#{number_to_delimited(@new_count)} new #{"issue".pluralize(@new_count)}"
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
def formatted_issue_counts
|
69
|
-
[formatted_new_issues, formatted_fixed_issues].compact.to_sentence
|
70
|
-
end
|
71
|
-
|
72
56
|
def formatted_percent(value)
|
73
57
|
"%g" % ("%.2f" % value)
|
74
58
|
end
|
75
|
-
|
76
|
-
def issue_counts
|
77
|
-
[@new_count, @fixed_count]
|
78
|
-
end
|
79
59
|
end
|
80
60
|
end
|
81
61
|
end
|
data/lib/cc/services/version.rb
CHANGED
@@ -2,23 +2,28 @@ require "cc/presenters/pull_requests_presenter"
|
|
2
2
|
|
3
3
|
describe CC::Service::PullRequestsPresenter, type: :service do
|
4
4
|
it "message singular" do
|
5
|
-
expect(
|
5
|
+
expect(build_presenter("fixed" => 1, "new" => 1).success_message).
|
6
|
+
to eq("1 new issue (1 fixed)")
|
6
7
|
end
|
7
8
|
|
8
9
|
it "message plural" do
|
9
|
-
expect(
|
10
|
+
expect(build_presenter("fixed" => 1, "new" => 2).success_message).
|
11
|
+
to eq("2 new issues (1 fixed)")
|
10
12
|
end
|
11
13
|
|
12
14
|
it "message only fixed" do
|
13
|
-
expect(
|
15
|
+
expect(build_presenter("fixed" => 1, "new" => 0).success_message).
|
16
|
+
to eq("1 fixed issue")
|
14
17
|
end
|
15
18
|
|
16
19
|
it "message only new" do
|
17
|
-
expect(
|
20
|
+
expect(build_presenter("fixed" => 0, "new" => 3).success_message).
|
21
|
+
to eq("3 new issues")
|
18
22
|
end
|
19
23
|
|
20
24
|
it "message no new or fixed" do
|
21
|
-
expect(
|
25
|
+
expect(build_presenter("fixed" => 0, "new" => 0).success_message).
|
26
|
+
to eq("no new or fixed issues")
|
22
27
|
end
|
23
28
|
|
24
29
|
it "message coverage same" do
|
@@ -10,7 +10,7 @@ describe CC::Service::GitHubPullRequests, type: :service do
|
|
10
10
|
|
11
11
|
it "pull request status success detailed" do
|
12
12
|
expect_status_update("pbrisbin/foo", "abc123", "state" => "success",
|
13
|
-
"description" => "
|
13
|
+
"description" => "2 new issues (1 fixed)")
|
14
14
|
|
15
15
|
receive_pull_request(
|
16
16
|
{},
|
@@ -22,7 +22,7 @@ describe CC::Service::GitHubPullRequests, type: :service do
|
|
22
22
|
|
23
23
|
it "pull request status failure" do
|
24
24
|
expect_status_update("pbrisbin/foo", "abc123", "state" => "failure",
|
25
|
-
"description" => "
|
25
|
+
"description" => "2 new issues (1 fixed)")
|
26
26
|
|
27
27
|
receive_pull_request(
|
28
28
|
{},
|
@@ -34,7 +34,7 @@ describe CC::Service::GitHubPullRequests, type: :service do
|
|
34
34
|
|
35
35
|
it "pull request status success generic" do
|
36
36
|
expect_status_update("pbrisbin/foo", "abc123", "state" => "success",
|
37
|
-
"description" => /
|
37
|
+
"description" => /2 new issues \(1 fixed\)/)
|
38
38
|
|
39
39
|
receive_pull_request({}, github_slug: "pbrisbin/foo",
|
40
40
|
commit_sha: "abc123",
|
@@ -20,7 +20,7 @@ describe CC::Service::GitlabMergeRequests, type: :service do
|
|
20
20
|
"hal/hal9000",
|
21
21
|
"abc123",
|
22
22
|
"state" => "success",
|
23
|
-
"description" => "
|
23
|
+
"description" => "2 new issues (1 fixed)",
|
24
24
|
)
|
25
25
|
|
26
26
|
receive_merge_request(
|
@@ -36,7 +36,7 @@ describe CC::Service::GitlabMergeRequests, type: :service do
|
|
36
36
|
"hal/hal9000",
|
37
37
|
"abc123",
|
38
38
|
"state" => "failed",
|
39
|
-
"description" => "
|
39
|
+
"description" => "2 new issues (1 fixed)",
|
40
40
|
)
|
41
41
|
|
42
42
|
receive_merge_request(
|
@@ -31,7 +31,7 @@ describe CC::Service::StashPullRequests, type: :service do
|
|
31
31
|
|
32
32
|
it "pull request status success detailed" do
|
33
33
|
expect_status_update("abc123", "state" => "SUCCESSFUL",
|
34
|
-
"description" => "
|
34
|
+
"description" => "2 new issues (1 fixed)")
|
35
35
|
|
36
36
|
receive_pull_request(
|
37
37
|
commit_sha: "abc123",
|
@@ -41,7 +41,7 @@ describe CC::Service::StashPullRequests, type: :service do
|
|
41
41
|
|
42
42
|
it "pull request status failure" do
|
43
43
|
expect_status_update("abc123", "state" => "FAILED",
|
44
|
-
"description" => "
|
44
|
+
"description" => "2 new issues (1 fixed)")
|
45
45
|
|
46
46
|
receive_pull_request(
|
47
47
|
commit_sha: "abc123",
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: codeclimate-services
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.9.
|
4
|
+
version: 1.9.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bryan Helmkamp
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-12-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|