|
15 | 15 | # limitations under the License. |
16 | 16 |
|
17 | 17 | require 'spec_helper' |
| 18 | +require 'logging_helper' |
18 | 19 | require 'java_buildpack/component/services' |
19 | 20 |
|
20 | 21 | describe JavaBuildpack::Component::Services do |
| 22 | + include_context 'logging_helper' |
21 | 23 |
|
22 | 24 | let(:service) do |
23 | 25 | { 'name' => 'test-name', 'label' => 'test-label', 'tags' => ['test-tag'], 'plan' => 'test-plan', |
|
46 | 48 | expect(services.one_service? /test-tag/).to be |
47 | 49 | end |
48 | 50 |
|
| 51 | + it 'should return false from one_service? if there is a matching service without required credentials' do |
| 52 | + expect(services.one_service? 'test-tag', 'bad-credential').not_to be |
| 53 | + expect(services.one_service? /test-tag/, 'bad-credential').not_to be |
| 54 | + end |
| 55 | + |
| 56 | + it 'should return true from one_service? if there is a matching service with required credentials' do |
| 57 | + expect(services.one_service? 'test-tag', 'uri').to be |
| 58 | + expect(services.one_service? /test-tag/, 'uri').to be |
| 59 | + end |
| 60 | + |
49 | 61 | it 'should return nil from find_service? if there is no service that matches' do |
50 | 62 | expect(services.find_service 'bad-test').to be_nil |
51 | 63 | expect(services.find_service /bad-test/).to be_nil |
52 | 64 | end |
53 | 65 |
|
54 | | - it 'should return true from one_service? if there is a matching name' do |
| 66 | + it 'should return service from find_service? if there is a matching name' do |
55 | 67 | expect(services.find_service 'test-name').to be(service) |
56 | 68 | expect(services.find_service /test-name/).to be(service) |
57 | 69 | end |
58 | 70 |
|
59 | | - it 'should return true from one_service? if there is a matching label' do |
| 71 | + it 'should return service from find_service? if there is a matching label' do |
60 | 72 | expect(services.find_service 'test-label').to be(service) |
61 | 73 | expect(services.find_service /test-label/).to be(service) |
62 | 74 | end |
63 | 75 |
|
64 | | - it 'should return true from one_service? if there is a matching tag' do |
| 76 | + it 'should return service from find_service? if there is a matching tag' do |
65 | 77 | expect(services.find_service 'test-tag').to be(service) |
66 | 78 | expect(services.find_service /test-tag/).to be(service) |
67 | 79 | end |
|
0 commit comments