build_eval 0.0.6 → 0.0.7
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
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
Yjk2OGI1MTg0ZWFiYjBhYTgyZDE4MmY5NzI2ODRkNDMyNWVjM2Y1NA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZjFmYmY4MjEzNzViNTYxZWExZmZiNTg1OTBiYTRjZWFiMjU3MDZmMw==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YThkNjhmN2Q4YmFmM2Q4NjU5MTk0ZjZjOGE3ZjAwODFkMWRjYjgyNWNkOTJl
|
10
|
+
MGYwMTUxNDVhMzRlZjE2Nzk0NjU0MjNiMDBlNTcwMzFhMThhNWNkNTNmOWFh
|
11
|
+
YmUxY2MxMTc1NTJlYTU4ZWIxMmU0Mjc5MmE5MzA1ZDQyYTE2NjM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YjY0ZTUyZGRiMWEyYTIxNzc2MGVhYmQ1ZjRjODEwZTc4NWRlNzI2NWFiNmRl
|
14
|
+
Y2JmZWIzNDU5YmVjMWI3ODlkOGJiNjhmOTFlZmI4YzgzZWIyODk5Yjg3YTRh
|
15
|
+
ODY3NTZhYWVjZjZhMzhjNTk2MzM3ZGI5NDg5ZDAyMTk1YWYyNTk=
|
@@ -9,7 +9,7 @@ module BuildEval
|
|
9
9
|
|
10
10
|
def build_result(name)
|
11
11
|
repo_string = "#{@username}/#{name}"
|
12
|
-
has_failed = ::Travis::Repository.find(repo_string).
|
12
|
+
has_failed = ::Travis::Repository.find(repo_string).recent_builds.first.failed?
|
13
13
|
BuildEval::Result::BuildResult.create(
|
14
14
|
build_name: repo_string,
|
15
15
|
status_name: has_failed ? "Failure" : "Success"
|
@@ -19,6 +19,7 @@ module BuildEval
|
|
19
19
|
def to_s
|
20
20
|
"Travis CI #{@username}"
|
21
21
|
end
|
22
|
+
|
22
23
|
end
|
23
24
|
|
24
25
|
end
|
@@ -10,7 +10,7 @@ module BuildEval
|
|
10
10
|
|
11
11
|
def build_result(name)
|
12
12
|
repo_string = "#{@username}/#{name}"
|
13
|
-
has_failed = ::Travis::Pro::Repository.find(repo_string).
|
13
|
+
has_failed = ::Travis::Pro::Repository.find(repo_string).recent_builds.first.failed?
|
14
14
|
BuildEval::Result::BuildResult.create(
|
15
15
|
build_name: repo_string,
|
16
16
|
status_name: has_failed ? "Failure" : "Success"
|
data/lib/build_eval/version.rb
CHANGED
@@ -19,7 +19,7 @@ describe BuildEval::Server::TravisPro do
|
|
19
19
|
subject { described_class.new(constructor_args) }
|
20
20
|
|
21
21
|
it "establishes the GitHub auth token" do
|
22
|
-
expect(Travis::Pro).to receive(:github_auth).with(github_token)
|
22
|
+
expect(::Travis::Pro).to receive(:github_auth).with(github_token)
|
23
23
|
|
24
24
|
subject
|
25
25
|
end
|
@@ -28,47 +28,72 @@ describe BuildEval::Server::TravisPro do
|
|
28
28
|
|
29
29
|
describe "#build_result" do
|
30
30
|
|
31
|
-
let(:build_name)
|
32
|
-
let(:travis_repository)
|
33
|
-
let(:
|
34
|
-
let(:
|
31
|
+
let(:build_name) { "some_build_name" }
|
32
|
+
let(:travis_repository) { instance_double(::Travis::Client::Repository) }
|
33
|
+
let(:recent_builds) { (1..3).map { instance_double(::Travis::Client::Build) } }
|
34
|
+
let(:last_build) { recent_builds.first }
|
35
|
+
let(:last_build_failed_flag) { false }
|
36
|
+
let(:build_result) { instance_double(BuildEval::Result::BuildResult) }
|
35
37
|
|
36
38
|
subject { travis_pro_server.build_result(build_name) }
|
37
39
|
|
38
40
|
before(:example) do
|
39
|
-
allow(Travis::Pro::Repository).to receive(:find).and_return(travis_repository)
|
40
|
-
allow(travis_repository).to receive(:
|
41
|
-
allow(
|
41
|
+
allow(::Travis::Pro::Repository).to receive(:find).and_return(travis_repository)
|
42
|
+
allow(travis_repository).to receive(:recent_builds).and_return(recent_builds)
|
43
|
+
allow(last_build).to receive(:failed?).and_return(last_build_failed_flag)
|
42
44
|
allow(BuildEval::Result::BuildResult).to receive(:create).and_return(build_result)
|
43
45
|
end
|
44
46
|
|
45
47
|
it "retrieves the relevant Travis repository" do
|
46
|
-
expect(Travis::Pro::Repository).to receive(:find).with("#{username}/#{build_name}")
|
48
|
+
expect(::Travis::Pro::Repository).to receive(:find).with("#{username}/#{build_name}")
|
47
49
|
|
48
50
|
subject
|
49
51
|
end
|
50
52
|
|
51
|
-
it "retrieves the
|
52
|
-
expect(travis_repository).to receive(:
|
53
|
+
it "retrieves the recent builds from Travis" do
|
54
|
+
expect(travis_repository).to receive(:recent_builds)
|
53
55
|
|
54
56
|
subject
|
55
57
|
end
|
56
58
|
|
57
|
-
it "retrieves the build status from the build" do
|
58
|
-
expect(
|
59
|
+
it "retrieves the build status from the last build" do
|
60
|
+
expect(last_build).to receive(:failed?)
|
59
61
|
|
60
62
|
subject
|
61
63
|
end
|
62
64
|
|
63
|
-
it "creates a build result" do
|
64
|
-
expect(BuildEval::Result::BuildResult).to
|
65
|
-
build_name:
|
66
|
-
|
67
|
-
).and_return(build_result)
|
65
|
+
it "creates a build result whose build name is the path to the repository" do
|
66
|
+
expect(BuildEval::Result::BuildResult).to(
|
67
|
+
receive(:create).with(hash_including(build_name: "#{username}/#{build_name}"))
|
68
|
+
)
|
68
69
|
|
69
70
|
subject
|
70
71
|
end
|
71
72
|
|
73
|
+
context "when the last build has passed" do
|
74
|
+
|
75
|
+
let(:last_build_failed_flag) { false }
|
76
|
+
|
77
|
+
it "creates a successful build result" do
|
78
|
+
expect(BuildEval::Result::BuildResult).to receive(:create).with(hash_including(status_name: "Success"))
|
79
|
+
|
80
|
+
subject
|
81
|
+
end
|
82
|
+
|
83
|
+
end
|
84
|
+
|
85
|
+
context "when the last build has failed" do
|
86
|
+
|
87
|
+
let(:last_build_failed_flag) { true }
|
88
|
+
|
89
|
+
it "creates a failed build result" do
|
90
|
+
expect(BuildEval::Result::BuildResult).to receive(:create).with(hash_including(status_name: "Failure"))
|
91
|
+
|
92
|
+
subject
|
93
|
+
end
|
94
|
+
|
95
|
+
end
|
96
|
+
|
72
97
|
it "returns the parsed build result" do
|
73
98
|
expect(subject).to eql(build_result)
|
74
99
|
end
|
@@ -8,47 +8,72 @@ 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(:
|
14
|
-
let(:
|
11
|
+
let(:build_name) { "some_build_name" }
|
12
|
+
let(:travis_repository) { instance_double(::Travis::Client::Repository) }
|
13
|
+
let(:recent_builds) { (1..3).map { instance_double(::Travis::Client::Build) } }
|
14
|
+
let(:last_build) { recent_builds.first }
|
15
|
+
let(:last_build_failed_flag) { false }
|
16
|
+
let(:build_result) { instance_double(BuildEval::Result::BuildResult) }
|
15
17
|
|
16
18
|
subject { travis_server.build_result(build_name) }
|
17
19
|
|
18
20
|
before(:example) do
|
19
|
-
allow(Travis::Repository).to receive(:find).and_return(travis_repository)
|
20
|
-
allow(travis_repository).to receive(:
|
21
|
-
allow(
|
21
|
+
allow(::Travis::Repository).to receive(:find).and_return(travis_repository)
|
22
|
+
allow(travis_repository).to receive(:recent_builds).and_return(recent_builds)
|
23
|
+
allow(last_build).to receive(:failed?).and_return(last_build_failed_flag)
|
22
24
|
allow(BuildEval::Result::BuildResult).to receive(:create).and_return(build_result)
|
23
25
|
end
|
24
26
|
|
25
27
|
it "retrieves the relevant Travis repository" do
|
26
|
-
expect(Travis::Repository).to receive(:find).with("#{username}/#{build_name}")
|
28
|
+
expect(::Travis::Repository).to receive(:find).with("#{username}/#{build_name}")
|
27
29
|
|
28
30
|
subject
|
29
31
|
end
|
30
32
|
|
31
|
-
it "retrieves the
|
32
|
-
expect(travis_repository).to receive(:
|
33
|
+
it "retrieves the recent builds from Travis" do
|
34
|
+
expect(travis_repository).to receive(:recent_builds)
|
33
35
|
|
34
36
|
subject
|
35
37
|
end
|
36
38
|
|
37
|
-
it "retrieves the
|
38
|
-
expect(
|
39
|
+
it "retrieves the status of the last build" do
|
40
|
+
expect(last_build).to receive(:failed?)
|
39
41
|
|
40
42
|
subject
|
41
43
|
end
|
42
44
|
|
43
|
-
it "creates a build result" do
|
44
|
-
expect(BuildEval::Result::BuildResult).to
|
45
|
-
build_name:
|
46
|
-
|
47
|
-
).and_return(build_result)
|
45
|
+
it "creates a build result whose build name is the path to the repository" do
|
46
|
+
expect(BuildEval::Result::BuildResult).to(
|
47
|
+
receive(:create).with(hash_including(build_name: "#{username}/#{build_name}"))
|
48
|
+
)
|
48
49
|
|
49
50
|
subject
|
50
51
|
end
|
51
52
|
|
53
|
+
context "when the last build has passed" do
|
54
|
+
|
55
|
+
let(:last_build_failed_flag) { false }
|
56
|
+
|
57
|
+
it "creates a successful build result" do
|
58
|
+
expect(BuildEval::Result::BuildResult).to receive(:create).with(hash_including(status_name: "Success"))
|
59
|
+
|
60
|
+
subject
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
64
|
+
|
65
|
+
context "when the last build has failed" do
|
66
|
+
|
67
|
+
let(:last_build_failed_flag) { true }
|
68
|
+
|
69
|
+
it "creates a failed build result" do
|
70
|
+
expect(BuildEval::Result::BuildResult).to receive(:create).with(hash_including(status_name: "Failure"))
|
71
|
+
|
72
|
+
subject
|
73
|
+
end
|
74
|
+
|
75
|
+
end
|
76
|
+
|
52
77
|
it "returns the parsed build result" do
|
53
78
|
expect(subject).to eql(build_result)
|
54
79
|
end
|