build_eval 0.0.5 → 0.0.6
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 +13 -5
- data/lib/build_eval/error.rb +4 -0
- data/lib/build_eval/http.rb +5 -1
- data/lib/build_eval/monitor/base.rb +4 -0
- data/lib/build_eval/monitor/composite.rb +4 -0
- data/lib/build_eval/monitor/server.rb +4 -0
- data/lib/build_eval/result/build_result.rb +6 -0
- data/lib/build_eval/result/composite_result.rb +4 -0
- data/lib/build_eval/result/server_result.rb +4 -0
- data/lib/build_eval/result/status.rb +11 -5
- data/lib/build_eval/server/cruise_control_response.rb +6 -2
- data/lib/build_eval/server/decorator.rb +4 -0
- data/lib/build_eval/server/invalid_selector_error.rb +4 -0
- data/lib/build_eval/server/jenkins.rb +4 -0
- data/lib/build_eval/server/team_city.rb +6 -2
- data/lib/build_eval/server/{travis_org.rb → travis.rb} +7 -4
- data/lib/build_eval/server/{travis_com.rb → travis_pro.rb} +9 -5
- data/lib/build_eval/version.rb +1 -1
- data/lib/build_eval.rb +7 -2
- data/spec/lib/build_eval/error_spec.rb +8 -4
- data/spec/lib/build_eval/http_shared_context.rb +3 -1
- data/spec/lib/build_eval/http_spec.rb +48 -29
- data/spec/lib/build_eval/monitor/base_spec.rb +7 -3
- data/spec/lib/build_eval/monitor/composite_spec.rb +8 -5
- data/spec/lib/build_eval/monitor/server_spec.rb +10 -6
- data/spec/lib/build_eval/result/build_result_spec.rb +29 -19
- data/spec/lib/build_eval/result/composite_result_spec.rb +18 -10
- data/spec/lib/build_eval/result/server_result_spec.rb +25 -13
- data/spec/lib/build_eval/result/status_spec.rb +70 -34
- data/spec/lib/build_eval/server/cruise_control_response_spec.rb +41 -25
- data/spec/lib/build_eval/server/decorator_spec.rb +31 -17
- data/spec/lib/build_eval/server/invalid_selector_error_spec.rb +11 -7
- data/spec/lib/build_eval/server/jenkins_integration_spec.rb +15 -10
- data/spec/lib/build_eval/server/jenkins_spec.rb +18 -13
- data/spec/lib/build_eval/server/server_shared_examples.rb +7 -3
- data/spec/lib/build_eval/server/team_city_integration_spec.rb +28 -19
- data/spec/lib/build_eval/server/team_city_spec.rb +17 -12
- data/spec/lib/build_eval/server/travis_pro_spec.rb +92 -0
- data/spec/lib/build_eval/server/{travis_org_spec.rb → travis_spec.rb} +24 -23
- data/spec/lib/build_eval_smoke_spec.rb +9 -6
- data/spec/lib/build_eval_spec.rb +16 -8
- metadata +92 -91
- data/spec/lib/build_eval/server/travis_com_spec.rb +0 -91
@@ -1,17 +1,20 @@
|
|
1
1
|
describe BuildEval::Server::CruiseControlResponse do
|
2
|
-
|
2
|
+
|
3
|
+
let(:raw_response) { double("RawResponse", body: response_body) }
|
3
4
|
|
4
5
|
let(:cruise_control_response) { described_class.new(raw_response) }
|
5
6
|
|
6
|
-
describe
|
7
|
-
|
7
|
+
describe "#parse_result" do
|
8
|
+
|
9
|
+
let(:build_name) { "some_build_name" }
|
8
10
|
let(:response_build_name) { build_name }
|
9
|
-
let(:project_selector) {
|
11
|
+
let(:project_selector) { "//Project[2]" }
|
10
12
|
|
11
13
|
subject { cruise_control_response.parse_result(project_selector) }
|
12
14
|
|
13
|
-
context
|
14
|
-
|
15
|
+
context "when the response is successful, containing projects" do
|
16
|
+
|
17
|
+
let(:latest_build_status) { "Success" }
|
15
18
|
let(:response_body) do
|
16
19
|
<<-RESPONSE
|
17
20
|
<Projects>
|
@@ -22,26 +25,31 @@ describe BuildEval::Server::CruiseControlResponse do
|
|
22
25
|
RESPONSE
|
23
26
|
end
|
24
27
|
|
25
|
-
context
|
26
|
-
|
27
|
-
|
28
|
+
context "and the selector matches a project" do
|
29
|
+
|
30
|
+
context "and the build name in the response is not a path" do
|
31
|
+
|
32
|
+
it "creates a build result with the build name from the response" do
|
28
33
|
expect(BuildEval::Result::BuildResult).to receive(:create).with(hash_including(build_name: build_name))
|
29
34
|
|
30
35
|
subject
|
31
36
|
end
|
37
|
+
|
32
38
|
end
|
33
39
|
|
34
|
-
context
|
40
|
+
context "and the build name in the response is a path" do
|
41
|
+
|
35
42
|
let(:response_build_name) { "some/path/to/#{build_name}" }
|
36
43
|
|
37
|
-
it
|
44
|
+
it "creates a build result with the build name from the response with the path omitted" do
|
38
45
|
expect(BuildEval::Result::BuildResult).to receive(:create).with(hash_including(build_name: build_name))
|
39
46
|
|
40
47
|
subject
|
41
48
|
end
|
49
|
+
|
42
50
|
end
|
43
51
|
|
44
|
-
it
|
52
|
+
it "creates a build result containing the latest build status" do
|
45
53
|
expect(BuildEval::Result::BuildResult).to(
|
46
54
|
receive(:create).with(hash_including(status_name: latest_build_status))
|
47
55
|
)
|
@@ -49,21 +57,23 @@ describe BuildEval::Server::CruiseControlResponse do
|
|
49
57
|
subject
|
50
58
|
end
|
51
59
|
|
52
|
-
it
|
60
|
+
it "returns the created result" do
|
53
61
|
build_result = instance_double(BuildEval::Result::BuildResult)
|
54
62
|
allow(BuildEval::Result::BuildResult).to receive(:create).and_return(build_result)
|
55
63
|
|
56
64
|
expect(subject).to eql(build_result)
|
57
65
|
end
|
66
|
+
|
58
67
|
end
|
59
68
|
|
60
|
-
context
|
61
|
-
|
62
|
-
let(:
|
69
|
+
context "and the selector does not match a project" do
|
70
|
+
|
71
|
+
let(:project_selector) { "does_not_match" }
|
72
|
+
let(:error) { "an error" }
|
63
73
|
|
64
74
|
before(:example) { allow(BuildEval::Server::InvalidSelectorError).to receive(:new).and_return(error) }
|
65
75
|
|
66
|
-
it
|
76
|
+
it "creates an invalid selector error" do
|
67
77
|
expect(BuildEval::Server::InvalidSelectorError).to(
|
68
78
|
receive(:new).with(raw_response, project_selector).and_return(error)
|
69
79
|
)
|
@@ -71,23 +81,26 @@ describe BuildEval::Server::CruiseControlResponse do
|
|
71
81
|
begin
|
72
82
|
subject
|
73
83
|
rescue
|
74
|
-
|
84
|
+
# intentionally blank
|
75
85
|
end
|
76
86
|
end
|
77
87
|
|
78
|
-
it
|
88
|
+
it "raises the error" do
|
79
89
|
expect { subject }.to raise_error(error)
|
80
90
|
end
|
91
|
+
|
81
92
|
end
|
93
|
+
|
82
94
|
end
|
83
95
|
|
84
|
-
context
|
85
|
-
|
86
|
-
let(:
|
96
|
+
context "when the response is in error" do
|
97
|
+
|
98
|
+
let(:response_body) { { "file" => "not found" }.to_json }
|
99
|
+
let(:error) { "an error" }
|
87
100
|
|
88
101
|
before(:example) { allow(BuildEval::Server::InvalidSelectorError).to receive(:new).and_return(error) }
|
89
102
|
|
90
|
-
it
|
103
|
+
it "creates an invalid selector error" do
|
91
104
|
expect(BuildEval::Server::InvalidSelectorError).to(
|
92
105
|
receive(:new).with(raw_response, project_selector).and_return(error)
|
93
106
|
)
|
@@ -95,13 +108,16 @@ describe BuildEval::Server::CruiseControlResponse do
|
|
95
108
|
begin
|
96
109
|
subject
|
97
110
|
rescue
|
98
|
-
|
111
|
+
# intentionally blank
|
99
112
|
end
|
100
113
|
end
|
101
114
|
|
102
|
-
it
|
115
|
+
it "raises an invalid selector error" do
|
103
116
|
expect { subject }.to raise_error(error)
|
104
117
|
end
|
118
|
+
|
105
119
|
end
|
120
|
+
|
106
121
|
end
|
122
|
+
|
107
123
|
end
|
@@ -1,83 +1,97 @@
|
|
1
1
|
describe BuildEval::Server::Decorator do
|
2
|
-
|
2
|
+
|
3
|
+
let(:server) { double("BuildEval::Server::Server") }
|
3
4
|
|
4
5
|
let(:decorator) { described_class.new(server) }
|
5
6
|
|
6
|
-
describe
|
7
|
-
|
7
|
+
describe "#build_result" do
|
8
|
+
|
9
|
+
let(:build_name) { "some build name" }
|
8
10
|
|
9
11
|
subject { decorator.build_result(build_name) }
|
10
12
|
|
11
|
-
it
|
13
|
+
it "delegates to the decorated server" do
|
12
14
|
expect(server).to receive(:build_result).with(build_name)
|
13
15
|
|
14
16
|
subject
|
15
17
|
end
|
16
18
|
|
17
|
-
context
|
19
|
+
context "when the decorated server returns a result" do
|
20
|
+
|
18
21
|
let(:build_result) { instance_double(BuildEval::Result::BuildResult) }
|
19
22
|
|
20
23
|
before(:example) { allow(server).to receive(:build_result).and_return(build_result) }
|
21
24
|
|
22
|
-
it
|
25
|
+
it "returns the result" do
|
23
26
|
expect(subject).to eql(build_result)
|
24
27
|
end
|
28
|
+
|
25
29
|
end
|
26
30
|
|
27
|
-
context
|
28
|
-
before(:example) { allow(server).to receive(:build_result).and_raise('Forced error') }
|
31
|
+
context "when the decorated server raises an error" do
|
29
32
|
|
30
|
-
|
33
|
+
before(:example) { allow(server).to receive(:build_result).and_raise("Forced error") }
|
34
|
+
|
35
|
+
it "creates an indeterminate result" do
|
31
36
|
expect(BuildEval::Result::BuildResult).to receive(:indeterminate).with(build_name)
|
32
37
|
|
33
38
|
subject
|
34
39
|
end
|
35
40
|
|
36
|
-
it
|
41
|
+
it "returns the indeterminate result" do
|
37
42
|
indeterminate_result = instance_double(BuildEval::Result::BuildResult)
|
38
43
|
allow(BuildEval::Result::BuildResult).to receive(:indeterminate).and_return(indeterminate_result)
|
39
44
|
|
40
45
|
expect(subject).to eql(indeterminate_result)
|
41
46
|
end
|
47
|
+
|
42
48
|
end
|
49
|
+
|
43
50
|
end
|
44
51
|
|
45
|
-
describe
|
52
|
+
describe "#monitor" do
|
53
|
+
|
46
54
|
let(:build_names) { (1..3).map { |i| "build##{i}" } }
|
47
55
|
|
48
56
|
subject { decorator.monitor(*build_names) }
|
49
57
|
|
50
|
-
it
|
58
|
+
it "creates a server monitor for the decorated server" do
|
51
59
|
expect(BuildEval::Monitor::Server).to receive(:new).with(hash_including(server: server))
|
52
60
|
|
53
61
|
subject
|
54
62
|
end
|
55
63
|
|
56
|
-
it
|
64
|
+
it "returns the server monitor" do
|
57
65
|
monitor = instance_double(BuildEval::Monitor::Server)
|
58
66
|
allow(BuildEval::Monitor::Server).to receive(:new).and_return(monitor)
|
59
67
|
|
60
68
|
expect(subject).to eql(monitor)
|
61
69
|
end
|
62
70
|
|
63
|
-
context
|
71
|
+
context "when an array of build names is provided" do
|
72
|
+
|
64
73
|
subject { decorator.monitor(build_names) }
|
65
74
|
|
66
|
-
it
|
75
|
+
it "creates a server monitor for the provided build names" do
|
67
76
|
expect(BuildEval::Monitor::Server).to receive(:new).with(hash_including(build_names: build_names))
|
68
77
|
|
69
78
|
subject
|
70
79
|
end
|
80
|
+
|
71
81
|
end
|
72
82
|
|
73
|
-
context
|
83
|
+
context "when variable argument list of build names is provided" do
|
84
|
+
|
74
85
|
subject { decorator.monitor(*build_names) }
|
75
86
|
|
76
|
-
it
|
87
|
+
it "creates a server monitor for the provided build names" do
|
77
88
|
expect(BuildEval::Monitor::Server).to receive(:new).with(hash_including(build_names: build_names))
|
78
89
|
|
79
90
|
subject
|
80
91
|
end
|
92
|
+
|
81
93
|
end
|
94
|
+
|
82
95
|
end
|
96
|
+
|
83
97
|
end
|
@@ -1,23 +1,27 @@
|
|
1
1
|
describe BuildEval::Server::InvalidSelectorError do
|
2
|
-
|
3
|
-
let(:
|
4
|
-
let(:
|
2
|
+
|
3
|
+
let(:response_message) { "Some response message" }
|
4
|
+
let(:response) { double("HttpResponse", message: response_message) }
|
5
|
+
let(:selector) { "some/selector" }
|
5
6
|
|
6
7
|
let(:error) { described_class.new(response, selector) }
|
7
8
|
|
8
|
-
describe
|
9
|
+
describe "#message" do
|
10
|
+
|
9
11
|
subject { error.message }
|
10
12
|
|
11
|
-
it
|
13
|
+
it "indicates the selector was not matched" do
|
12
14
|
expect(subject).to match(/response did not match selector/i)
|
13
15
|
end
|
14
16
|
|
15
|
-
it
|
17
|
+
it "contains a message describing the response" do
|
16
18
|
expect(subject).to include(response_message)
|
17
19
|
end
|
18
20
|
|
19
|
-
it
|
21
|
+
it "contains the selector that was invalid" do
|
20
22
|
expect(subject).to include(selector)
|
21
23
|
end
|
24
|
+
|
22
25
|
end
|
26
|
+
|
23
27
|
end
|
@@ -1,20 +1,22 @@
|
|
1
|
-
describe BuildEval::Server::Jenkins,
|
2
|
-
include_context
|
1
|
+
describe BuildEval::Server::Jenkins, "integrating with a response parser", integration: true do
|
2
|
+
include_context "stubbed http interactions"
|
3
3
|
|
4
|
-
let(:uri) {
|
4
|
+
let(:uri) { "https://some.jenkins.server" }
|
5
5
|
|
6
6
|
let(:jenkins) { described_class.new(uri: uri) }
|
7
7
|
|
8
|
-
describe
|
9
|
-
|
8
|
+
describe "#build_result" do
|
9
|
+
|
10
|
+
let(:build_name) { "some_build_name" }
|
10
11
|
let(:response) { instance_double(Net::HTTPResponse, body: response_body) }
|
11
12
|
|
12
13
|
subject { jenkins.build_result(build_name) }
|
13
14
|
|
14
15
|
before(:example) { allow(http).to receive(:get).and_return(response) }
|
15
16
|
|
16
|
-
context
|
17
|
-
|
17
|
+
context "when the server responds successfully with build results" do
|
18
|
+
|
19
|
+
let(:latest_build_status) { "Failure" }
|
18
20
|
let(:response_body) do
|
19
21
|
<<-RESPONSE
|
20
22
|
<Projects>
|
@@ -25,23 +27,26 @@ describe BuildEval::Server::Jenkins, 'integrating with a response parser', integ
|
|
25
27
|
RESPONSE
|
26
28
|
end
|
27
29
|
|
28
|
-
it
|
30
|
+
it "creates a build result containing the build name" do
|
29
31
|
expect(BuildEval::Result::BuildResult).to receive(:create).with(hash_including(build_name: build_name))
|
30
32
|
|
31
33
|
subject
|
32
34
|
end
|
33
35
|
|
34
|
-
it
|
36
|
+
it "creates a build result containing the latest build status" do
|
35
37
|
expect(BuildEval::Result::BuildResult).to receive(:create).with(hash_including(status_name: latest_build_status))
|
36
38
|
subject
|
37
39
|
end
|
38
40
|
|
39
|
-
it
|
41
|
+
it "returns the created result" do
|
40
42
|
build_result = instance_double(BuildEval::Result::BuildResult)
|
41
43
|
allow(BuildEval::Result::BuildResult).to receive(:create).and_return(build_result)
|
42
44
|
|
43
45
|
expect(subject).to eql(build_result)
|
44
46
|
end
|
47
|
+
|
45
48
|
end
|
49
|
+
|
46
50
|
end
|
51
|
+
|
47
52
|
end
|
@@ -1,17 +1,18 @@
|
|
1
1
|
describe BuildEval::Server::Jenkins do
|
2
|
-
include_context
|
2
|
+
include_context "stubbed http interactions"
|
3
3
|
|
4
|
-
let(:uri) {
|
4
|
+
let(:uri) { "https://some.jenkins.server" }
|
5
5
|
let(:constructor_args) { { uri: uri } }
|
6
6
|
|
7
7
|
let(:jenkins_server) { described_class.new(constructor_args) }
|
8
8
|
|
9
|
-
it_behaves_like
|
9
|
+
it_behaves_like "a continuous integration server" do
|
10
10
|
let(:server) { jenkins_server }
|
11
11
|
end
|
12
12
|
|
13
|
-
describe
|
14
|
-
|
13
|
+
describe "#build_result" do
|
14
|
+
|
15
|
+
let(:build_name) { "some_build_name" }
|
15
16
|
let(:response) { instance_double(Net::HTTPResponse) }
|
16
17
|
let(:build_result) { instance_double(BuildEval::Result::BuildResult) }
|
17
18
|
let(:cruise_control_response) do
|
@@ -26,38 +27,42 @@ describe BuildEval::Server::Jenkins do
|
|
26
27
|
allow(cruise_control_response).to receive(:parse_result).and_return(build_result)
|
27
28
|
end
|
28
29
|
|
29
|
-
it
|
30
|
+
it "issues a GET request for the build" do
|
30
31
|
expect(http).to receive(:get).with("#{uri}/cc.xml")
|
31
32
|
|
32
33
|
subject
|
33
34
|
end
|
34
35
|
|
35
|
-
it
|
36
|
+
it "creates a Cruise Control response containing the GET request response" do
|
36
37
|
expect(BuildEval::Server::CruiseControlResponse).to receive(:new).with(response)
|
37
38
|
|
38
39
|
subject
|
39
40
|
end
|
40
41
|
|
41
|
-
it
|
42
|
+
it "parses the Cruise Control response to return the project with a matching build name" do
|
42
43
|
expect(cruise_control_response).to receive(:parse_result).with(a_string_including(build_name))
|
43
44
|
|
44
45
|
subject
|
45
46
|
end
|
46
47
|
|
47
|
-
it
|
48
|
+
it "returns the parsed build result" do
|
48
49
|
expect(subject).to eql(build_result)
|
49
50
|
end
|
51
|
+
|
50
52
|
end
|
51
53
|
|
52
|
-
describe
|
54
|
+
describe "#to_s" do
|
55
|
+
|
53
56
|
subject { jenkins_server.to_s }
|
54
57
|
|
55
|
-
it
|
56
|
-
expect(subject).to include(
|
58
|
+
it "returns a string indicating it is a Jenkins server" do
|
59
|
+
expect(subject).to include("Jenkins server")
|
57
60
|
end
|
58
61
|
|
59
|
-
it
|
62
|
+
it "returns a string containing the username" do
|
60
63
|
expect(subject).to include(uri)
|
61
64
|
end
|
65
|
+
|
62
66
|
end
|
67
|
+
|
63
68
|
end
|
@@ -1,11 +1,15 @@
|
|
1
|
-
shared_examples_for
|
2
|
-
|
1
|
+
shared_examples_for "a continuous integration server" do
|
2
|
+
|
3
|
+
describe "constructor" do
|
4
|
+
|
3
5
|
subject { server }
|
4
6
|
|
5
|
-
it
|
7
|
+
it "creates a http object with any provided http configuration options" do
|
6
8
|
expect(BuildEval::Http).to receive(:new).with(constructor_args)
|
7
9
|
|
8
10
|
subject
|
9
11
|
end
|
12
|
+
|
10
13
|
end
|
14
|
+
|
11
15
|
end
|
@@ -1,12 +1,13 @@
|
|
1
|
-
describe BuildEval::Server::TeamCity,
|
2
|
-
include_context
|
1
|
+
describe BuildEval::Server::TeamCity, "integrating with a response parser", integration: true do
|
2
|
+
include_context "stubbed http interactions"
|
3
3
|
|
4
|
-
let(:uri) {
|
4
|
+
let(:uri) { "https://some.teamcity.server" }
|
5
5
|
|
6
6
|
let(:team_city_server) { described_class.new(uri: uri) }
|
7
7
|
|
8
|
-
describe
|
9
|
-
|
8
|
+
describe "#build_result" do
|
9
|
+
|
10
|
+
let(:build_name) { "some_build_name" }
|
10
11
|
let(:response_message) { nil }
|
11
12
|
let(:response_body) { nil }
|
12
13
|
let(:response) { instance_double(Net::HTTPResponse, message: response_message, body: response_body) }
|
@@ -15,9 +16,10 @@ describe BuildEval::Server::TeamCity, 'integrating with a response parser', inte
|
|
15
16
|
|
16
17
|
before(:example) { allow(http).to receive(:get).and_return(response) }
|
17
18
|
|
18
|
-
context
|
19
|
-
|
20
|
-
let(:
|
19
|
+
context "when the server responds with build results" do
|
20
|
+
|
21
|
+
let(:latest_build_status) { "FAILED" }
|
22
|
+
let(:response_message) { "OK" }
|
21
23
|
let(:response_body) do
|
22
24
|
<<-RESPONSE
|
23
25
|
<builds count="3" href="/httpAuth/app/rest/buildTypes/#{build_name}/builds/" nextHref="/httpAuth/app/rest/buildTypes/#{build_name}/builds/?count=3&start=3">
|
@@ -28,13 +30,13 @@ describe BuildEval::Server::TeamCity, 'integrating with a response parser', inte
|
|
28
30
|
RESPONSE
|
29
31
|
end
|
30
32
|
|
31
|
-
it
|
33
|
+
it "creates a build result containing the build name" do
|
32
34
|
expect(BuildEval::Result::BuildResult).to receive(:create).with(hash_including(build_name: build_name))
|
33
35
|
|
34
36
|
subject
|
35
37
|
end
|
36
38
|
|
37
|
-
it
|
39
|
+
it "creates a build result containing the latest build status" do
|
38
40
|
expect(BuildEval::Result::BuildResult).to(
|
39
41
|
receive(:create).with(hash_including(status_name: latest_build_status))
|
40
42
|
)
|
@@ -42,35 +44,42 @@ describe BuildEval::Server::TeamCity, 'integrating with a response parser', inte
|
|
42
44
|
subject
|
43
45
|
end
|
44
46
|
|
45
|
-
it
|
47
|
+
it "returns the created result" do
|
46
48
|
build_result = instance_double(BuildEval::Result::BuildResult)
|
47
49
|
allow(BuildEval::Result::BuildResult).to receive(:create).and_return(build_result)
|
48
50
|
|
49
51
|
expect(subject).to eql(build_result)
|
50
52
|
end
|
53
|
+
|
51
54
|
end
|
52
55
|
|
53
|
-
context
|
54
|
-
let(:response_message) { 'Unauthorized' }
|
55
|
-
let(:response_body) { 'Incorrect username or password' }
|
56
|
+
context "when the server authentication request fails" do
|
56
57
|
|
57
|
-
|
58
|
+
let(:response_message) { "Unauthorized" }
|
59
|
+
let(:response_body) { "Incorrect username or password" }
|
60
|
+
|
61
|
+
it "raises an error" do
|
58
62
|
expect { subject }.to raise_error(/Unauthorized/)
|
59
63
|
end
|
64
|
+
|
60
65
|
end
|
61
66
|
|
62
|
-
context
|
63
|
-
|
67
|
+
context "when the build is not found" do
|
68
|
+
|
69
|
+
let(:response_message) { "Not Found" }
|
64
70
|
let(:response_body) do
|
65
71
|
<<-BODY
|
66
72
|
Error has occurred during request processing (Not Found).
|
67
|
-
Error: jetbrains.buildServer.server.rest.errors.NotFoundException: No build type nor template is found by id
|
73
|
+
Error: jetbrains.buildServer.server.rest.errors.NotFoundException: No build type nor template is found by id "#{build_name}".
|
68
74
|
BODY
|
69
75
|
end
|
70
76
|
|
71
|
-
it
|
77
|
+
it "raises an error" do
|
72
78
|
expect { subject }.to raise_error(/Not Found/)
|
73
79
|
end
|
80
|
+
|
74
81
|
end
|
82
|
+
|
75
83
|
end
|
84
|
+
|
76
85
|
end
|
@@ -1,19 +1,20 @@
|
|
1
1
|
describe BuildEval::Server::TeamCity do
|
2
|
-
include_context
|
2
|
+
include_context "stubbed http interactions"
|
3
3
|
|
4
|
-
let(:uri) {
|
5
|
-
let(:username) {
|
6
|
-
let(:password) {
|
4
|
+
let(:uri) { "https://some.teamcity.server" }
|
5
|
+
let(:username) { "some_username" }
|
6
|
+
let(:password) { "some_password" }
|
7
7
|
let(:constructor_args) { { uri: uri, username: username, password: password } }
|
8
8
|
|
9
9
|
let(:team_city_server) { described_class.new(constructor_args) }
|
10
10
|
|
11
|
-
it_behaves_like
|
11
|
+
it_behaves_like "a continuous integration server" do
|
12
12
|
let(:server) { team_city_server }
|
13
13
|
end
|
14
14
|
|
15
|
-
describe
|
16
|
-
|
15
|
+
describe "#build_result" do
|
16
|
+
|
17
|
+
let(:build_name) { "some_build_name" }
|
17
18
|
let(:response_body) do
|
18
19
|
<<-RESPONSE
|
19
20
|
<builds count="3" href="/httpAuth/app/rest/buildTypes/#{build_name}/builds/" nextHref="/httpAuth/app/rest/buildTypes/#{build_name}/builds/?count=3&start=3">
|
@@ -27,22 +28,26 @@ describe BuildEval::Server::TeamCity do
|
|
27
28
|
|
28
29
|
before(:example) { allow(http).to receive(:get).and_return(response) }
|
29
30
|
|
30
|
-
it
|
31
|
+
it "issues a GET request for the build" do
|
31
32
|
expect(http).to receive(:get).with("#{uri}/httpAuth/app/rest/buildTypes/id:#{build_name}/builds")
|
32
33
|
|
33
34
|
subject
|
34
35
|
end
|
36
|
+
|
35
37
|
end
|
36
38
|
|
37
|
-
describe
|
39
|
+
describe "#to_s" do
|
40
|
+
|
38
41
|
subject { team_city_server.to_s }
|
39
42
|
|
40
|
-
it
|
41
|
-
expect(subject).to include(
|
43
|
+
it "returns a string indicating it is a TeamCity server" do
|
44
|
+
expect(subject).to include("TeamCity")
|
42
45
|
end
|
43
46
|
|
44
|
-
it
|
47
|
+
it "returns a string containing the uri to the server" do
|
45
48
|
expect(subject).to include(uri)
|
46
49
|
end
|
50
|
+
|
47
51
|
end
|
52
|
+
|
48
53
|
end
|