build_eval 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
N2I3Zjc5OWM0NDBmMTQ1MTM1YjVhODE1OWI3NTk0NzE1NGI0Y2Y3Mg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NWUyZDEyMzExZDM0NjkwMzY5MWNjNDczNGRkMzg0YTE0OWNlYzcxMg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NTc3NGQyZmNiZjg0MmFjYzE2NDFkZmQ2OTBhZTc5ZTRhZjI2NTdkMmY5ZThh
|
10
|
+
N2NlNDUyODA4ZjgxMzlhMjhjMGU3N2NlNDljMGI0MmI4OGI5YWI3YWM4Y2E1
|
11
|
+
MzI1ZDc4YTdiOGNmMjYwMjIyYjU5MDBhOTAzMDBmOWUxNjYxZjU=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MTQzZWEyOWY2NmExZTBiZTkxNDhkOTM2M2EyYmZmOTZhOGYyMzcyMzVmYjgx
|
14
|
+
YTgzODM5ODM3YzRmMjE2NDg0NDcxN2NmNDZjZTZjMzA1MGJhZjE3MDEyNjY5
|
15
|
+
ZDkwOWIwOTQzYmRhNTZjNWYyMzdhMWE0ZjI2YTRhZTYwZjc5MWE=
|
@@ -8,18 +8,20 @@ module BuildEval
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def build_result(name)
|
11
|
-
|
12
|
-
|
13
|
-
BuildEval::Result::BuildResult.create(
|
14
|
-
build_name: repo_string,
|
15
|
-
status_name: has_failed ? "Failure" : "Success"
|
16
|
-
)
|
11
|
+
build_path = "#{@username}/#{name}"
|
12
|
+
BuildEval::Result::BuildResult.create(build_name: build_path, status_name: last_status_name(build_path))
|
17
13
|
end
|
18
14
|
|
19
15
|
def to_s
|
20
16
|
"Travis CI #{@username}"
|
21
17
|
end
|
22
18
|
|
19
|
+
private
|
20
|
+
|
21
|
+
def last_status_name(build_path)
|
22
|
+
::Travis::Repository.find(build_path).recent_builds.find(&:finished?).passed? ? "Success" : "Failure"
|
23
|
+
end
|
24
|
+
|
23
25
|
end
|
24
26
|
|
25
27
|
end
|
@@ -9,11 +9,8 @@ module BuildEval
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def build_result(name)
|
12
|
-
|
13
|
-
BuildEval::Result::BuildResult.create(
|
14
|
-
build_name: repository_path,
|
15
|
-
status_name: last_build_failed?(repository_path) ? "Failure" : "Success"
|
16
|
-
)
|
12
|
+
build_path = "#{@username}/#{name}"
|
13
|
+
BuildEval::Result::BuildResult.create(build_name: build_path, status_name: last_status_name(build_path))
|
17
14
|
end
|
18
15
|
|
19
16
|
def to_s
|
@@ -22,9 +19,9 @@ module BuildEval
|
|
22
19
|
|
23
20
|
private
|
24
21
|
|
25
|
-
def
|
22
|
+
def last_status_name(build_path)
|
26
23
|
::Travis::Pro.github_auth(@github_token)
|
27
|
-
::Travis::Pro::Repository.find(
|
24
|
+
::Travis::Pro::Repository.find(build_path).recent_builds.find(&:finished?).passed? ? "Success" : "Failure"
|
28
25
|
end
|
29
26
|
|
30
27
|
end
|
data/lib/build_eval/version.rb
CHANGED
@@ -14,12 +14,14 @@ describe BuildEval::Server::TravisPro do
|
|
14
14
|
|
15
15
|
describe "#build_result" do
|
16
16
|
|
17
|
-
let(:build_name)
|
18
|
-
let(:travis_repository)
|
19
|
-
let(:recent_builds)
|
20
|
-
|
21
|
-
|
22
|
-
let(:
|
17
|
+
let(:build_name) { "some_build_name" }
|
18
|
+
let(:travis_repository) { instance_double(::Travis::Client::Repository) }
|
19
|
+
let(:recent_builds) do
|
20
|
+
(1..3).map { |i| instance_double(::Travis::Client::Build, finished?: i > 1) }
|
21
|
+
end
|
22
|
+
let(:last_finished_build) { recent_builds[1] }
|
23
|
+
let(:last_finished_build_passed_flag) { true }
|
24
|
+
let(:build_result) { instance_double(BuildEval::Result::BuildResult) }
|
23
25
|
|
24
26
|
subject { travis_pro_server.build_result(build_name) }
|
25
27
|
|
@@ -27,7 +29,7 @@ describe BuildEval::Server::TravisPro do
|
|
27
29
|
allow(::Travis::Pro).to receive(:github_auth)
|
28
30
|
allow(::Travis::Pro::Repository).to receive(:find).and_return(travis_repository)
|
29
31
|
allow(travis_repository).to receive(:recent_builds).and_return(recent_builds)
|
30
|
-
allow(
|
32
|
+
allow(last_finished_build).to receive(:passed?).and_return(last_finished_build_passed_flag)
|
31
33
|
allow(BuildEval::Result::BuildResult).to receive(:create).and_return(build_result)
|
32
34
|
end
|
33
35
|
|
@@ -49,8 +51,8 @@ describe BuildEval::Server::TravisPro do
|
|
49
51
|
subject
|
50
52
|
end
|
51
53
|
|
52
|
-
it "determines if the last build has
|
53
|
-
expect(
|
54
|
+
it "determines if the last finished build has passed" do
|
55
|
+
expect(last_finished_build).to receive(:passed?)
|
54
56
|
|
55
57
|
subject
|
56
58
|
end
|
@@ -63,9 +65,9 @@ describe BuildEval::Server::TravisPro do
|
|
63
65
|
subject
|
64
66
|
end
|
65
67
|
|
66
|
-
context "when the last build
|
68
|
+
context "when the last finished build passed" do
|
67
69
|
|
68
|
-
let(:
|
70
|
+
let(:last_finished_build_passed_flag) { true }
|
69
71
|
|
70
72
|
it "creates a successful build result" do
|
71
73
|
expect(BuildEval::Result::BuildResult).to receive(:create).with(hash_including(status_name: "Success"))
|
@@ -75,9 +77,9 @@ describe BuildEval::Server::TravisPro do
|
|
75
77
|
|
76
78
|
end
|
77
79
|
|
78
|
-
context "when the last build
|
80
|
+
context "when the last finished build failed" do
|
79
81
|
|
80
|
-
let(:
|
82
|
+
let(:last_finished_build_passed_flag) { false }
|
81
83
|
|
82
84
|
it "creates a failed build result" do
|
83
85
|
expect(BuildEval::Result::BuildResult).to receive(:create).with(hash_including(status_name: "Failure"))
|
@@ -8,19 +8,21 @@ describe BuildEval::Server::Travis do
|
|
8
8
|
|
9
9
|
describe "#build_result" do
|
10
10
|
|
11
|
-
let(:build_name)
|
12
|
-
let(:travis_repository)
|
13
|
-
let(:recent_builds)
|
14
|
-
|
15
|
-
|
16
|
-
let(:
|
11
|
+
let(:build_name) { "some_build_name" }
|
12
|
+
let(:travis_repository) { instance_double(::Travis::Client::Repository) }
|
13
|
+
let(:recent_builds) do
|
14
|
+
(1..3).map { |i| instance_double(::Travis::Client::Build, finished?: i > 1) }
|
15
|
+
end
|
16
|
+
let(:last_finished_build) { recent_builds[1] }
|
17
|
+
let(:last_finished_build_passed_flag) { true }
|
18
|
+
let(:build_result) { instance_double(BuildEval::Result::BuildResult) }
|
17
19
|
|
18
20
|
subject { travis_server.build_result(build_name) }
|
19
21
|
|
20
22
|
before(:example) do
|
21
23
|
allow(::Travis::Repository).to receive(:find).and_return(travis_repository)
|
22
24
|
allow(travis_repository).to receive(:recent_builds).and_return(recent_builds)
|
23
|
-
allow(
|
25
|
+
allow(last_finished_build).to receive(:passed?).and_return(last_finished_build_passed_flag)
|
24
26
|
allow(BuildEval::Result::BuildResult).to receive(:create).and_return(build_result)
|
25
27
|
end
|
26
28
|
|
@@ -36,8 +38,8 @@ describe BuildEval::Server::Travis do
|
|
36
38
|
subject
|
37
39
|
end
|
38
40
|
|
39
|
-
it "determines if the last build has
|
40
|
-
expect(
|
41
|
+
it "determines if the last finished build has passed" do
|
42
|
+
expect(last_finished_build).to receive(:passed?)
|
41
43
|
|
42
44
|
subject
|
43
45
|
end
|
@@ -50,9 +52,9 @@ describe BuildEval::Server::Travis do
|
|
50
52
|
subject
|
51
53
|
end
|
52
54
|
|
53
|
-
context "when the last build
|
55
|
+
context "when the last finished build passed" do
|
54
56
|
|
55
|
-
let(:
|
57
|
+
let(:last_finished_build_passed_flag) { true }
|
56
58
|
|
57
59
|
it "creates a successful build result" do
|
58
60
|
expect(BuildEval::Result::BuildResult).to receive(:create).with(hash_including(status_name: "Success"))
|
@@ -62,9 +64,9 @@ describe BuildEval::Server::Travis do
|
|
62
64
|
|
63
65
|
end
|
64
66
|
|
65
|
-
context "when the last build
|
67
|
+
context "when the last finished build failed" do
|
66
68
|
|
67
|
-
let(:
|
69
|
+
let(:last_finished_build_passed_flag) { false }
|
68
70
|
|
69
71
|
it "creates a failed build result" do
|
70
72
|
expect(BuildEval::Result::BuildResult).to receive(:create).with(hash_including(status_name: "Failure"))
|