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