build_eval 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/build_eval/error.rb +0 -4
- data/lib/build_eval/http.rb +1 -5
- data/lib/build_eval/monitor/base.rb +2 -6
- data/lib/build_eval/monitor/composite.rb +0 -4
- data/lib/build_eval/monitor/server.rb +0 -3
- data/lib/build_eval/result/build_result.rb +2 -8
- data/lib/build_eval/result/composite_result.rb +0 -4
- data/lib/build_eval/result/server_result.rb +0 -4
- data/lib/build_eval/result/status.rb +9 -17
- data/lib/build_eval/server/cruise_control_response.rb +2 -6
- data/lib/build_eval/server/decorator.rb +3 -9
- data/lib/build_eval/server/invalid_selector_error.rb +0 -4
- data/lib/build_eval/server/jenkins.rb +0 -4
- data/lib/build_eval/server/team_city.rb +2 -6
- data/lib/build_eval/server/travis_com.rb +23 -0
- data/lib/build_eval/server/travis_org.rb +22 -0
- data/lib/build_eval/version.rb +1 -1
- data/lib/build_eval.rb +7 -11
- data/spec/lib/build_eval/error_spec.rb +4 -8
- data/spec/lib/build_eval/http_shared_context.rb +2 -4
- data/spec/lib/build_eval/http_spec.rb +30 -50
- data/spec/lib/build_eval/monitor/base_spec.rb +3 -7
- data/spec/lib/build_eval/monitor/composite_spec.rb +5 -9
- data/spec/lib/build_eval/monitor/server_spec.rb +6 -10
- data/spec/lib/build_eval/result/build_result_spec.rb +19 -30
- data/spec/lib/build_eval/result/composite_result_spec.rb +10 -18
- data/spec/lib/build_eval/result/server_result_spec.rb +14 -26
- data/spec/lib/build_eval/result/status_spec.rb +35 -73
- data/spec/lib/build_eval/server/cruise_control_response_spec.rb +33 -41
- data/spec/lib/build_eval/server/decorator_spec.rb +17 -31
- data/spec/lib/build_eval/server/invalid_selector_error_spec.rb +7 -11
- data/spec/lib/build_eval/server/jenkins_integration_spec.rb +10 -15
- data/spec/lib/build_eval/server/jenkins_spec.rb +17 -24
- data/spec/lib/build_eval/server/server_shared_examples.rb +3 -7
- data/spec/lib/build_eval/server/team_city_integration_spec.rb +18 -27
- data/spec/lib/build_eval/server/team_city_spec.rb +13 -20
- data/spec/lib/build_eval/server/travis_com_spec.rb +91 -0
- data/spec/lib/build_eval/server/travis_org_spec.rb +71 -0
- data/spec/lib/build_eval_smoke_spec.rb +11 -10
- data/spec/lib/build_eval_spec.rb +8 -16
- data/spec/spec_helper.rb +4 -4
- metadata +33 -18
- data/lib/build_eval/server/travis.rb +0 -23
- data/spec/lib/build_eval/server/travis_integration_spec.rb +0 -53
- data/spec/lib/build_eval/server/travis_spec.rb +0 -70
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2c32dba8242b9791724f68774da3882fbff6d6f3
|
4
|
+
data.tar.gz: 9b0ac4ca5b0ecdad1bf4fa02cf7052fee8c3630a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: af37b3850de9b567e633194aaef3f146460fcfd2d7e673d138c5a681099042dfee9431c36d61fbb2073321e75d547c428a226f1caeb44154ab698034b1acb3b6
|
7
|
+
data.tar.gz: ea266ac251292a56461437f5ece2ada4fb9c7643c47cf792fd39354d6bb4087fa71a27951a9702f17c266ec410dc72eb8ef3fb7037983acb7e23f914ef7e7064
|
data/lib/build_eval/error.rb
CHANGED
data/lib/build_eval/http.rb
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
module BuildEval
|
2
|
-
|
3
2
|
class Http
|
4
|
-
|
5
3
|
def initialize(config)
|
6
4
|
@username = config[:username]
|
7
5
|
@password = config[:password]
|
@@ -20,11 +18,9 @@ module BuildEval
|
|
20
18
|
private
|
21
19
|
|
22
20
|
def ssl_options(uri)
|
23
|
-
ssl_options = { use_ssl: uri.scheme ==
|
21
|
+
ssl_options = { use_ssl: uri.scheme == 'https' }
|
24
22
|
ssl_options[:ssl_verify_mode] = @ssl_verify_mode if @ssl_verify_mode
|
25
23
|
ssl_options
|
26
24
|
end
|
27
|
-
|
28
25
|
end
|
29
|
-
|
30
26
|
end
|
@@ -1,8 +1,6 @@
|
|
1
1
|
module BuildEval
|
2
2
|
module Monitor
|
3
|
-
|
4
3
|
class Composite < BuildEval::Monitor::Base
|
5
|
-
|
6
4
|
def initialize(*monitors)
|
7
5
|
@monitors = monitors
|
8
6
|
end
|
@@ -10,8 +8,6 @@ module BuildEval
|
|
10
8
|
def evaluate
|
11
9
|
BuildEval::Result::CompositeResult.new(@monitors.map(&:evaluate))
|
12
10
|
end
|
13
|
-
|
14
11
|
end
|
15
|
-
|
16
12
|
end
|
17
13
|
end
|
@@ -1,8 +1,6 @@
|
|
1
1
|
module BuildEval
|
2
2
|
module Monitor
|
3
|
-
|
4
3
|
class Server < BuildEval::Monitor::Base
|
5
|
-
|
6
4
|
def initialize(args)
|
7
5
|
@server = args[:server]
|
8
6
|
@build_names = args[:build_names]
|
@@ -12,7 +10,6 @@ module BuildEval
|
|
12
10
|
build_results = @build_names.map { |build_name| @server.build_result(build_name) }
|
13
11
|
BuildEval::Result::ServerResult.new(@server, build_results)
|
14
12
|
end
|
15
|
-
|
16
13
|
end
|
17
14
|
end
|
18
15
|
end
|
@@ -1,18 +1,14 @@
|
|
1
1
|
module BuildEval
|
2
2
|
module Result
|
3
|
-
|
4
3
|
class BuildResult
|
5
|
-
|
6
4
|
class << self
|
7
|
-
|
8
5
|
def create(args)
|
9
|
-
|
6
|
+
new(build_name: args[:build_name], status: BuildEval::Result::Status.find(args[:status_name]))
|
10
7
|
end
|
11
8
|
|
12
9
|
def indeterminate(build_name)
|
13
|
-
|
10
|
+
new(build_name: build_name, status: BuildEval::Result::Status::INDETERMINATE)
|
14
11
|
end
|
15
|
-
|
16
12
|
end
|
17
13
|
|
18
14
|
attr_reader :build_name
|
@@ -34,8 +30,6 @@ module BuildEval
|
|
34
30
|
def to_s
|
35
31
|
"#{@build_name}: #{@status}"
|
36
32
|
end
|
37
|
-
|
38
33
|
end
|
39
|
-
|
40
34
|
end
|
41
35
|
end
|
@@ -1,8 +1,6 @@
|
|
1
1
|
module BuildEval
|
2
2
|
module Result
|
3
|
-
|
4
3
|
class ServerResult
|
5
|
-
|
6
4
|
def initialize(server, build_results)
|
7
5
|
@server = server
|
8
6
|
@build_results = build_results
|
@@ -19,8 +17,6 @@ module BuildEval
|
|
19
17
|
def to_s
|
20
18
|
"#{@server}: #{@build_results.map(&:to_s).join(", ")}"
|
21
19
|
end
|
22
|
-
|
23
20
|
end
|
24
|
-
|
25
21
|
end
|
26
22
|
end
|
@@ -1,8 +1,6 @@
|
|
1
1
|
module BuildEval
|
2
2
|
module Result
|
3
|
-
|
4
3
|
class Status
|
5
|
-
|
6
4
|
private
|
7
5
|
|
8
6
|
def initialize(args)
|
@@ -13,26 +11,22 @@ module BuildEval
|
|
13
11
|
|
14
12
|
public
|
15
13
|
|
16
|
-
SUCCESS =
|
17
|
-
UNKNOWN =
|
18
|
-
INDETERMINATE =
|
19
|
-
FAILURE =
|
20
|
-
ERROR =
|
14
|
+
SUCCESS = new(severity: 0, symbol: :success!, description: 'succeeded')
|
15
|
+
UNKNOWN = new(severity: 1, symbol: :warning!, description: 'unknown')
|
16
|
+
INDETERMINATE = new(severity: 2, symbol: :warning!, description: 'indeterminate')
|
17
|
+
FAILURE = new(severity: 3, symbol: :failure!, description: 'failed')
|
18
|
+
ERROR = new(severity: 4, symbol: :failure!, description: 'errored')
|
21
19
|
|
22
20
|
class << self
|
23
|
-
|
24
21
|
def find(name)
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
raise "Build status '#{name}' is invalid"
|
29
|
-
end
|
22
|
+
const_get(name.upcase)
|
23
|
+
rescue NameError
|
24
|
+
raise "Build status '#{name}' is invalid"
|
30
25
|
end
|
31
26
|
|
32
27
|
def effective_status(statuses)
|
33
|
-
statuses.sort_by
|
28
|
+
statuses.sort_by(&:severity).last
|
34
29
|
end
|
35
|
-
|
36
30
|
end
|
37
31
|
|
38
32
|
attr_reader :severity
|
@@ -48,8 +42,6 @@ module BuildEval
|
|
48
42
|
def to_s
|
49
43
|
@description
|
50
44
|
end
|
51
|
-
|
52
45
|
end
|
53
|
-
|
54
46
|
end
|
55
47
|
end
|
@@ -1,8 +1,6 @@
|
|
1
1
|
module BuildEval
|
2
2
|
module Server
|
3
|
-
|
4
3
|
class CruiseControlResponse
|
5
|
-
|
6
4
|
def initialize(raw_response)
|
7
5
|
@raw_response = raw_response
|
8
6
|
end
|
@@ -11,12 +9,10 @@ module BuildEval
|
|
11
9
|
build_element = Nokogiri::XML(@raw_response.body).xpath(project_selector).first
|
12
10
|
raise BuildEval::Server::InvalidSelectorError.new(@raw_response, project_selector) unless build_element
|
13
11
|
BuildEval::Result::BuildResult.create(
|
14
|
-
build_name: build_element.attribute(
|
15
|
-
status_name: build_element.attribute(
|
12
|
+
build_name: build_element.attribute('name').value.match(%r{[^\/]+$})[0],
|
13
|
+
status_name: build_element.attribute('lastBuildStatus').value
|
16
14
|
)
|
17
15
|
end
|
18
|
-
|
19
16
|
end
|
20
|
-
|
21
17
|
end
|
22
18
|
end
|
@@ -1,25 +1,19 @@
|
|
1
1
|
module BuildEval
|
2
2
|
module Server
|
3
|
-
|
4
3
|
class Decorator
|
5
|
-
|
6
4
|
def initialize(delegate)
|
7
5
|
@delegate = delegate
|
8
6
|
end
|
9
7
|
|
10
8
|
def build_result(name)
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
BuildEval::Result::BuildResult.indeterminate(name)
|
15
|
-
end
|
9
|
+
@delegate.build_result(name)
|
10
|
+
rescue StandardError
|
11
|
+
BuildEval::Result::BuildResult.indeterminate(name)
|
16
12
|
end
|
17
13
|
|
18
14
|
def monitor(*build_names)
|
19
15
|
BuildEval::Monitor::Server.new(server: @delegate, build_names: build_names.flatten)
|
20
16
|
end
|
21
|
-
|
22
17
|
end
|
23
|
-
|
24
18
|
end
|
25
19
|
end
|
@@ -1,13 +1,9 @@
|
|
1
1
|
module BuildEval
|
2
2
|
module Server
|
3
|
-
|
4
3
|
class InvalidSelectorError < BuildEval::Error
|
5
|
-
|
6
4
|
def initialize(response, selector)
|
7
5
|
super("Build response did not match selector:\nResponse: #{response.message}\nSelector: #{selector}")
|
8
6
|
end
|
9
|
-
|
10
7
|
end
|
11
|
-
|
12
8
|
end
|
13
9
|
end
|
@@ -1,8 +1,6 @@
|
|
1
1
|
module BuildEval
|
2
2
|
module Server
|
3
|
-
|
4
3
|
class Jenkins
|
5
|
-
|
6
4
|
def initialize(args)
|
7
5
|
@http = BuildEval::Http.new(args)
|
8
6
|
@base_uri = args[:uri]
|
@@ -16,8 +14,6 @@ module BuildEval
|
|
16
14
|
def to_s
|
17
15
|
"Jenkins server #{@base_uri}"
|
18
16
|
end
|
19
|
-
|
20
17
|
end
|
21
|
-
|
22
18
|
end
|
23
19
|
end
|
@@ -1,8 +1,6 @@
|
|
1
1
|
module BuildEval
|
2
2
|
module Server
|
3
|
-
|
4
3
|
class TeamCity
|
5
|
-
|
6
4
|
def initialize(args)
|
7
5
|
@http = BuildEval::Http.new(args)
|
8
6
|
@base_uri = args[:uri]
|
@@ -10,16 +8,14 @@ module BuildEval
|
|
10
8
|
|
11
9
|
def build_result(name)
|
12
10
|
response = @http.get("#{@base_uri}/httpAuth/app/rest/buildTypes/id:#{name}/builds")
|
13
|
-
build_element = Nokogiri::XML(response.body).xpath(
|
11
|
+
build_element = Nokogiri::XML(response.body).xpath('//build').first
|
14
12
|
raise "Unexpected build response: #{response.message}" unless build_element
|
15
|
-
BuildEval::Result::BuildResult.create(build_name: name, status_name: build_element.attribute(
|
13
|
+
BuildEval::Result::BuildResult.create(build_name: name, status_name: build_element.attribute('status').value)
|
16
14
|
end
|
17
15
|
|
18
16
|
def to_s
|
19
17
|
"TeamCity server #{@base_uri}"
|
20
18
|
end
|
21
|
-
|
22
19
|
end
|
23
|
-
|
24
20
|
end
|
25
21
|
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module BuildEval
|
2
|
+
module Server
|
3
|
+
class TravisCom
|
4
|
+
def initialize(args)
|
5
|
+
@username = args[:username]
|
6
|
+
Travis::Pro.github_auth(args[:github_token])
|
7
|
+
end
|
8
|
+
|
9
|
+
def build_result(name)
|
10
|
+
repo_string = "#{@username}/#{name}"
|
11
|
+
has_failed = Travis::Pro::Repository.find(repo_string).last_build.failed?
|
12
|
+
BuildEval::Result::BuildResult.create(
|
13
|
+
build_name: repo_string,
|
14
|
+
status_name: has_failed ? 'Failure' : 'Success'
|
15
|
+
)
|
16
|
+
end
|
17
|
+
|
18
|
+
def to_s
|
19
|
+
"Travis CI Com #{@username}"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module BuildEval
|
2
|
+
module Server
|
3
|
+
class TravisOrg
|
4
|
+
def initialize(args)
|
5
|
+
@username = args[:username]
|
6
|
+
end
|
7
|
+
|
8
|
+
def build_result(name)
|
9
|
+
repo_string = "#{@username}/#{name}"
|
10
|
+
has_failed = Travis::Repository.find(repo_string).last_build.failed?
|
11
|
+
BuildEval::Result::BuildResult.create(
|
12
|
+
build_name: repo_string,
|
13
|
+
status_name: has_failed ? 'Failure' : 'Success'
|
14
|
+
)
|
15
|
+
end
|
16
|
+
|
17
|
+
def to_s
|
18
|
+
"Travis CI Org #{@username}"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
data/lib/build_eval/version.rb
CHANGED
data/lib/build_eval.rb
CHANGED
@@ -2,6 +2,8 @@ require 'nokogiri'
|
|
2
2
|
require 'uri'
|
3
3
|
require 'net/http'
|
4
4
|
require 'net/https'
|
5
|
+
require 'travis'
|
6
|
+
require 'travis/tools/github'
|
5
7
|
require_relative 'build_eval/error'
|
6
8
|
require_relative 'build_eval/http'
|
7
9
|
require_relative 'build_eval/result/status'
|
@@ -12,16 +14,15 @@ require_relative 'build_eval/server/invalid_selector_error'
|
|
12
14
|
require_relative 'build_eval/server/decorator'
|
13
15
|
require_relative 'build_eval/server/cruise_control_response'
|
14
16
|
require_relative 'build_eval/server/team_city'
|
15
|
-
require_relative 'build_eval/server/
|
17
|
+
require_relative 'build_eval/server/travis_org'
|
18
|
+
require_relative 'build_eval/server/travis_com'
|
16
19
|
require_relative 'build_eval/server/jenkins'
|
17
20
|
require_relative 'build_eval/monitor/base'
|
18
21
|
require_relative 'build_eval/monitor/server'
|
19
22
|
require_relative 'build_eval/monitor/composite'
|
20
23
|
|
21
24
|
module BuildEval
|
22
|
-
|
23
25
|
class << self
|
24
|
-
|
25
26
|
def server(args)
|
26
27
|
type_args = args.clone
|
27
28
|
server_type = type_args.delete(:type)
|
@@ -31,14 +32,9 @@ module BuildEval
|
|
31
32
|
private
|
32
33
|
|
33
34
|
def server_class_for(type)
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
raise "Server type '#{type}' is invalid"
|
38
|
-
end
|
39
|
-
|
35
|
+
BuildEval::Server.const_get(type.to_s)
|
36
|
+
rescue NameError
|
37
|
+
raise "Server type '#{type}' is invalid"
|
40
38
|
end
|
41
|
-
|
42
39
|
end
|
43
|
-
|
44
40
|
end
|
@@ -1,21 +1,17 @@
|
|
1
1
|
describe BuildEval::Error do
|
2
|
-
|
3
|
-
let(:message) { "some message" }
|
2
|
+
let(:message) { 'some message' }
|
4
3
|
|
5
4
|
let(:error) { described_class.new(message) }
|
6
5
|
|
7
|
-
it
|
6
|
+
it 'is a standard error' do
|
8
7
|
expect(error).to be_a(::StandardError)
|
9
8
|
end
|
10
9
|
|
11
|
-
describe
|
12
|
-
|
10
|
+
describe '#messsage' do
|
13
11
|
subject { error.message }
|
14
12
|
|
15
|
-
it
|
13
|
+
it 'returns the provided message' do
|
16
14
|
expect(subject).to eql(message)
|
17
15
|
end
|
18
|
-
|
19
16
|
end
|
20
|
-
|
21
17
|
end
|
@@ -1,102 +1,82 @@
|
|
1
1
|
describe BuildEval::Http do
|
2
|
-
|
3
2
|
let(:config) { {} }
|
4
3
|
|
5
4
|
let(:http) { described_class.new(config) }
|
6
5
|
|
7
|
-
shared_examples_for
|
8
|
-
|
9
|
-
let(:
|
10
|
-
let(:response_body) { "Some Response Body" }
|
6
|
+
shared_examples_for 'a http method returning a response' do
|
7
|
+
let(:response_status) { %w(200 OK) }
|
8
|
+
let(:response_body) { 'Some Response Body' }
|
11
9
|
|
12
|
-
it
|
10
|
+
it 'returns a response containing the response body' do
|
13
11
|
expect(subject.body).to eql(response_body)
|
14
12
|
end
|
15
13
|
|
16
|
-
it
|
17
|
-
expect(subject.code).to eql(
|
14
|
+
it 'returns a response containing the response status' do
|
15
|
+
expect(subject.code).to eql('200')
|
18
16
|
end
|
19
17
|
|
20
|
-
it
|
21
|
-
expect(subject.message).to eql(
|
18
|
+
it 'returns a response containing the response message' do
|
19
|
+
expect(subject.message).to eql('OK')
|
22
20
|
end
|
23
|
-
|
24
21
|
end
|
25
22
|
|
26
|
-
describe
|
27
|
-
|
28
|
-
let(:
|
29
|
-
let(:
|
30
|
-
let(:path) { "some/path" }
|
23
|
+
describe '#get' do
|
24
|
+
let(:scheme) { 'http' }
|
25
|
+
let(:host) { 'a.host' }
|
26
|
+
let(:path) { 'some/path' }
|
31
27
|
let(:uri_string) { "#{scheme}://#{host}/#{path}" }
|
32
28
|
|
33
29
|
subject { http.get(uri_string) }
|
34
30
|
|
35
|
-
context
|
36
|
-
|
31
|
+
context 'when the uri is valid' do
|
37
32
|
let(:expected_request_uri) { uri_string }
|
38
33
|
|
39
34
|
before(:example) do
|
40
35
|
FakeWeb.register_uri(:get, expected_request_uri, status: response_status, body: response_body)
|
41
36
|
end
|
42
37
|
|
43
|
-
context
|
44
|
-
|
45
|
-
let(:scheme) { "http" }
|
46
|
-
|
47
|
-
it_behaves_like "a http method returning a response"
|
38
|
+
context 'and the uri contains a http scheme' do
|
39
|
+
let(:scheme) { 'http' }
|
48
40
|
|
41
|
+
it_behaves_like 'a http method returning a response'
|
49
42
|
end
|
50
43
|
|
51
|
-
context
|
52
|
-
|
53
|
-
let(:scheme) { "https" }
|
54
|
-
|
55
|
-
it_behaves_like "a http method returning a response"
|
44
|
+
context 'and the uri contains a https scheme' do
|
45
|
+
let(:scheme) { 'https' }
|
56
46
|
|
47
|
+
it_behaves_like 'a http method returning a response'
|
57
48
|
end
|
58
49
|
|
59
|
-
context
|
60
|
-
|
50
|
+
context 'and an ssl verification mode configuration option was established' do
|
61
51
|
let(:ssl_verification_mode) { OpenSSL::SSL::VERIFY_NONE }
|
62
52
|
let(:config) { { ssl_verify_mode: ssl_verification_mode } }
|
63
53
|
|
64
|
-
it_behaves_like
|
65
|
-
|
54
|
+
it_behaves_like 'a http method returning a response'
|
66
55
|
end
|
67
56
|
|
68
|
-
context
|
69
|
-
|
70
|
-
let(:config) { { username: "some_username" } }
|
71
|
-
|
72
|
-
it_behaves_like "a http method returning a response"
|
57
|
+
context 'and partial authentication configuration options were established' do
|
58
|
+
let(:config) { { username: 'some_username' } }
|
73
59
|
|
60
|
+
it_behaves_like 'a http method returning a response'
|
74
61
|
end
|
75
62
|
|
76
|
-
context
|
77
|
-
|
78
|
-
let(:
|
79
|
-
let(:password) { "some_password" }
|
63
|
+
context 'and basic authentication configuration options were established' do
|
64
|
+
let(:username) { 'some_username' }
|
65
|
+
let(:password) { 'some_password' }
|
80
66
|
let(:config) { { username: username, password: password } }
|
81
67
|
|
82
68
|
let(:expected_request_uri) { "#{scheme}://#{username}:#{password}@#{host}/#{path}" }
|
83
69
|
|
84
|
-
it_behaves_like
|
85
|
-
|
70
|
+
it_behaves_like 'a http method returning a response'
|
86
71
|
end
|
87
|
-
|
88
72
|
end
|
89
73
|
|
90
|
-
context
|
91
|
-
|
74
|
+
context 'when the uri is invalid' do
|
92
75
|
before(:example) { FakeWeb.clean_registry }
|
93
76
|
|
94
|
-
it
|
77
|
+
it 'raises an error' do
|
95
78
|
expect { subject }.to raise_error(SocketError)
|
96
79
|
end
|
97
|
-
|
98
80
|
end
|
99
|
-
|
100
81
|
end
|
101
|
-
|
102
82
|
end
|
@@ -1,29 +1,25 @@
|
|
1
1
|
describe BuildEval::Monitor::Base do
|
2
|
-
|
3
2
|
class BuildEval::Monitor::TestableBase < BuildEval::Monitor::Base
|
4
3
|
end
|
5
4
|
|
6
5
|
let(:base_monitor) { BuildEval::Monitor::TestableBase.new }
|
7
6
|
|
8
|
-
describe
|
9
|
-
|
7
|
+
describe '#+' do
|
10
8
|
let(:provided_monitor) { instance_double(BuildEval::Monitor::Base) }
|
11
9
|
|
12
10
|
subject { base_monitor + provided_monitor }
|
13
11
|
|
14
|
-
it
|
12
|
+
it 'creates a composite monitor combining the monitor with the provided monitor' do
|
15
13
|
expect(BuildEval::Monitor::Composite).to receive(:new).with(base_monitor, provided_monitor)
|
16
14
|
|
17
15
|
subject
|
18
16
|
end
|
19
17
|
|
20
|
-
it
|
18
|
+
it 'returns the composite monitor' do
|
21
19
|
composite_monitor = instance_double(BuildEval::Monitor::Composite)
|
22
20
|
allow(BuildEval::Monitor::Composite).to receive(:new).and_return(composite_monitor)
|
23
21
|
|
24
22
|
expect(subject).to eql(composite_monitor)
|
25
23
|
end
|
26
|
-
|
27
24
|
end
|
28
|
-
|
29
25
|
end
|