Skip to content

Commit d579482

Browse files
committed
Adapt unittest
1 parent aaf5206 commit d579482

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

docs/v3/source/includes/api_resources/_info.erb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"description": "Put your apps here!",
1212
"name": "Cloud Foundry",
1313
"version": 123,
14+
"osbapi_version": 456,
1415
"links": {
1516
"self": { "href": "http://api.example.com/v3/info" } ,
1617
"support": { "href": "http://support.example.com" }
@@ -29,6 +30,7 @@
2930
"description": "",
3031
"name": "",
3132
"version": 0,
33+
"osbapi_version": "",
3234
"links": {
3335
"self": { "href": "http://api.example.com/v3/info" } ,
3436
"support": { "href": "" }

spec/request/info_spec.rb

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,22 @@
1414
description: TestConfig.config[:info][:description],
1515
name: TestConfig.config[:info][:name],
1616
version: TestConfig.config[:info][:version],
17+
osbapi_version: TestConfig.config[:info][:osbapi_version],
1718
links: {
1819
self: { href: "#{link_prefix}/v3/info" },
1920
support: { href: TestConfig.config[:info][:support_address] }
2021
}
2122
}
2223
end
2324

25+
before do
26+
allow(File).to receive(:exist?).and_call_original
27+
allow(File).to receive(:exist?).with(Rails.root.join('config/osbapi_version').to_s).and_return(true)
28+
allow(File).to receive(:read).with(Rails.root.join('config/osbapi_version').to_s).and_return('1.0.0')
29+
30+
TestConfig.override(info: TestConfig.config[:info].merge(osbapi_version: '1.0.0'))
31+
end
32+
2433
it 'includes data from the config' do
2534
get '/v3/info'
2635
expect(Oj.load(last_response.body)).to match_json_response(return_info_json)
@@ -38,7 +47,7 @@
3847
description: '',
3948
name: '',
4049
version: 0,
41-
osbapi_version: 0,
50+
osbapi_version: '',
4251
links: {
4352
self: { href: "#{link_prefix}/v3/info" },
4453
support: { href: '' }
@@ -48,6 +57,7 @@
4857

4958
before do
5059
TestConfig.override(info: nil)
60+
allow(File).to receive(:exist?).with(Rails.root.join('config/osbapi_version').to_s).and_return(false)
5161
end
5262

5363
it 'includes has proper empty values' do

0 commit comments

Comments
 (0)