build_eval 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -1,91 +0,0 @@
1
- describe BuildEval::Server::TravisCom do
2
- include_context 'stubbed http interactions'
3
-
4
- let(:username) { 'some_username' }
5
- let(:github_token) { 'ABCD1234' }
6
- let(:constructor_args) do
7
- {
8
- username: username,
9
- github_token: github_token
10
- }
11
- end
12
-
13
- let(:travis_server) { described_class.new(constructor_args) }
14
-
15
- before(:example) do
16
- allow(Travis::Pro).to receive(:github_auth)
17
- end
18
-
19
- describe '#initialize' do
20
- subject { described_class.new(constructor_args) }
21
-
22
- it 'should set the github auth token' do
23
- expect(Travis::Pro).to receive(:github_auth).with(github_token)
24
-
25
- subject
26
- end
27
- end
28
-
29
- describe '#build_result' do
30
- let(:build_name) { 'some_build_name' }
31
- let(:travis_repository) { instance_double(Travis::Client::Repository) }
32
- let(:travis_build) { instance_double(Travis::Client::Build) }
33
- let(:build_result) { instance_double(BuildEval::Result::BuildResult) }
34
-
35
- subject { travis_server.build_result(build_name) }
36
-
37
- before(:example) do
38
- allow(Travis::Pro::Repository).to receive(:find).and_return(travis_repository)
39
- allow(travis_repository).to receive(:last_build).and_return(travis_build)
40
- allow(travis_build).to receive(:failed?).and_return(false)
41
- allow(BuildEval::Result::BuildResult).to receive(:create).and_return(build_result)
42
- end
43
-
44
- it 'retrieves the relevant Travis repository' do
45
- expect(Travis::Pro::Repository).to receive(:find).with("#{username}/#{build_name}").and_return(travis_repository)
46
-
47
- begin
48
- subject
49
- rescue
50
- Exception
51
- end
52
- end
53
-
54
- it 'retrieves the last build on the Travis repository' do
55
- expect(travis_repository).to receive(:last_build).and_return(travis_build)
56
-
57
- subject
58
- end
59
-
60
- it 'retrieves the build status from the build' do
61
- expect(travis_build).to receive(:failed?).and_return(false)
62
-
63
- subject
64
- end
65
-
66
- it 'creates a build result' do
67
- expect(BuildEval::Result::BuildResult).to receive(:create).with(
68
- build_name: "#{username}/#{build_name}",
69
- status_name: 'Success'
70
- ).and_return(build_result)
71
-
72
- subject
73
- end
74
-
75
- it 'returns the parsed build result' do
76
- expect(subject).to eql(build_result)
77
- end
78
- end
79
-
80
- describe '#to_s' do
81
- subject { travis_server.to_s }
82
-
83
- it 'returns a string indicating it uses the Travis CI Org service' do
84
- expect(subject).to include('Travis CI Com')
85
- end
86
-
87
- it 'returns a string containing the username' do
88
- expect(subject).to include(username)
89
- end
90
- end
91
- end