MuranoCLI 3.2.0.beta.9 → 3.2.1.pre.beta.3
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.
- checksums.yaml +4 -4
- data/.rubocop.yml +3 -0
- data/Rakefile +5 -0
- data/dockers/README.rst +7 -0
- data/dockers/RELEASE.rst +6 -3
- data/dockers/docker-test.sh +45 -17
- data/docs/completions/murano_completion-bash +211 -86
- data/lib/MrMurano/Account.rb +72 -4
- data/lib/MrMurano/Business.rb +163 -2
- data/lib/MrMurano/Commander-Entry.rb +1 -2
- data/lib/MrMurano/Config.rb +19 -18
- data/lib/MrMurano/Content.rb +26 -19
- data/lib/MrMurano/Gateway.rb +51 -10
- data/lib/MrMurano/ReCommander.rb +1 -1
- data/lib/MrMurano/Solution-Services.rb +80 -35
- data/lib/MrMurano/Solution-Users.rb +1 -0
- data/lib/MrMurano/SyncRoot.rb +10 -3
- data/lib/MrMurano/SyncUpDown-Core.rb +47 -36
- data/lib/MrMurano/SyncUpDown-Item.rb +46 -14
- data/lib/MrMurano/SyncUpDown.rb +22 -20
- data/lib/MrMurano/Webservice-Endpoint.rb +20 -18
- data/lib/MrMurano/Webservice-File.rb +63 -20
- data/lib/MrMurano/commands/business.rb +14 -1
- data/lib/MrMurano/commands/child.rb +148 -0
- data/lib/MrMurano/commands/devices.rb +298 -149
- data/lib/MrMurano/commands/element.rb +2 -1
- data/lib/MrMurano/commands/globals.rb +3 -0
- data/lib/MrMurano/commands/network.rb +152 -33
- data/lib/MrMurano/commands/sync.rb +2 -2
- data/lib/MrMurano/commands.rb +1 -0
- data/lib/MrMurano/verbosing.rb +13 -2
- data/lib/MrMurano/version.rb +1 -1
- data/spec/Account_spec.rb +43 -11
- data/spec/Content_spec.rb +5 -3
- data/spec/GatewayBase_spec.rb +1 -1
- data/spec/GatewayDevice_spec.rb +47 -8
- data/spec/GatewayResource_spec.rb +1 -1
- data/spec/GatewaySettings_spec.rb +1 -1
- data/spec/HttpAuthed_spec.rb +17 -3
- data/spec/ProjectFile_spec.rb +59 -23
- data/spec/Setting_spec.rb +2 -1
- data/spec/Solution-ServiceConfig_spec.rb +1 -1
- data/spec/Solution-ServiceEventHandler_spec.rb +27 -20
- data/spec/Solution-ServiceModules_spec.rb +7 -5
- data/spec/Solution-UsersRoles_spec.rb +7 -1
- data/spec/Solution_spec.rb +9 -1
- data/spec/SyncRoot_spec.rb +5 -5
- data/spec/SyncUpDown_spec.rb +262 -211
- data/spec/Verbosing_spec.rb +49 -8
- data/spec/Webservice-Cors_spec.rb +10 -1
- data/spec/Webservice-Endpoint_spec.rb +84 -65
- data/spec/Webservice-File_spec.rb +16 -11
- data/spec/Webservice-Setting_spec.rb +7 -1
- data/spec/_workspace.rb +9 -0
- data/spec/cmd_business_spec.rb +5 -10
- data/spec/cmd_common.rb +67 -32
- data/spec/cmd_config_spec.rb +9 -14
- data/spec/cmd_content_spec.rb +15 -26
- data/spec/cmd_cors_spec.rb +9 -12
- data/spec/cmd_device_spec.rb +31 -45
- data/spec/cmd_domain_spec.rb +12 -10
- data/spec/cmd_element_spec.rb +18 -17
- data/spec/cmd_exchange_spec.rb +1 -4
- data/spec/cmd_init_spec.rb +56 -72
- data/spec/cmd_keystore_spec.rb +17 -26
- data/spec/cmd_link_spec.rb +13 -17
- data/spec/cmd_password_spec.rb +9 -10
- data/spec/cmd_setting_application_spec.rb +95 -68
- data/spec/cmd_setting_product_spec.rb +59 -37
- data/spec/cmd_status_spec.rb +46 -84
- data/spec/cmd_syncdown_application_spec.rb +28 -50
- data/spec/cmd_syncdown_both_spec.rb +44 -93
- data/spec/cmd_syncdown_unit_spec.rb +858 -0
- data/spec/cmd_syncup_spec.rb +21 -56
- data/spec/cmd_token_spec.rb +0 -3
- data/spec/cmd_usage_spec.rb +15 -10
- data/spec/dry_run_formatter.rb +1 -0
- data/spec/fixtures/dumped_config +4 -4
- data/spec/spec_helper.rb +3 -0
- metadata +4 -2
data/spec/Content_spec.rb
CHANGED
|
@@ -24,8 +24,8 @@ require 'HttpAuthed_spec'
|
|
|
24
24
|
|
|
25
25
|
RSpec.describe MrMurano::Content::Base do
|
|
26
26
|
include_context 'WORKSPACE'
|
|
27
|
+
|
|
27
28
|
before(:example) do
|
|
28
|
-
MrMurano::SyncRoot.instance.reset
|
|
29
29
|
$cfg = MrMurano::Config.new
|
|
30
30
|
$cfg.load
|
|
31
31
|
$cfg['net.host'] = 'bizapi.hosted.exosite.io'
|
|
@@ -343,7 +343,9 @@ RSpec.describe MrMurano::Content::Base do
|
|
|
343
343
|
:get, 'https://s3-us-west-1.amazonaws.com/murano-content-service-staging/XXX/ZZZ'
|
|
344
344
|
).to_return(body: 'FOOOOOOOOOOOO')
|
|
345
345
|
|
|
346
|
-
expect
|
|
346
|
+
expect do |b|
|
|
347
|
+
@ct.download('TODO.taskpaper', &b)
|
|
348
|
+
end.to yield_with_args('FOOOOOOOOOOOO')
|
|
347
349
|
end
|
|
348
350
|
|
|
349
351
|
it "something that isn't there" do
|
|
@@ -371,7 +373,7 @@ RSpec.describe MrMurano::Content::Base do
|
|
|
371
373
|
|
|
372
374
|
ret = @ct.download('Notthere')
|
|
373
375
|
expect(ret).to match(Net::HTTPNotFound)
|
|
374
|
-
expect($stderr.string).to eq("\e[31mRequest Failed: 404:
|
|
376
|
+
expect($stderr.string).to eq("\e[31mRequest Failed: 404: #{resp}\e[0m\n")
|
|
375
377
|
$stderr = saved
|
|
376
378
|
end
|
|
377
379
|
|
data/spec/GatewayBase_spec.rb
CHANGED
|
@@ -15,8 +15,8 @@ require 'HttpAuthed_spec'
|
|
|
15
15
|
|
|
16
16
|
RSpec.describe MrMurano::Gateway::GweBase do
|
|
17
17
|
include_context 'WORKSPACE'
|
|
18
|
+
|
|
18
19
|
before(:example) do
|
|
19
|
-
MrMurano::SyncRoot.instance.reset
|
|
20
20
|
$cfg = MrMurano::Config.new
|
|
21
21
|
$cfg.load
|
|
22
22
|
$cfg['net.host'] = 'bizapi.hosted.exosite.io'
|
data/spec/GatewayDevice_spec.rb
CHANGED
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
# Unauthorized copying of this file is strictly prohibited.
|
|
7
7
|
|
|
8
8
|
require 'fileutils'
|
|
9
|
+
require 'webmock'
|
|
10
|
+
|
|
9
11
|
require 'MrMurano/version'
|
|
10
12
|
require 'MrMurano/HttpAuthed'
|
|
11
13
|
require 'MrMurano/Gateway'
|
|
@@ -15,8 +17,8 @@ require 'HttpAuthed_spec'
|
|
|
15
17
|
|
|
16
18
|
RSpec.describe MrMurano::Gateway::Device do
|
|
17
19
|
include_context 'WORKSPACE'
|
|
20
|
+
|
|
18
21
|
before(:example) do
|
|
19
|
-
MrMurano::SyncRoot.instance.reset
|
|
20
22
|
$cfg = MrMurano::Config.new
|
|
21
23
|
$cfg.load
|
|
22
24
|
$cfg['net.host'] = 'bizapi.hosted.exosite.io'
|
|
@@ -29,7 +31,10 @@ RSpec.describe MrMurano::Gateway::Device do
|
|
|
29
31
|
|
|
30
32
|
it 'initializes' do
|
|
31
33
|
uri = @gw.endpoint('/')
|
|
32
|
-
expect(uri.to_s).to eq(
|
|
34
|
+
expect(uri.to_s).to eq(
|
|
35
|
+
'https://bizapi.hosted.exosite.io/api:1/service/XYZ/device2/identity/'
|
|
36
|
+
)
|
|
37
|
+
WebMock.reset!
|
|
33
38
|
end
|
|
34
39
|
|
|
35
40
|
context 'listing' do
|
|
@@ -65,6 +70,8 @@ RSpec.describe MrMurano::Gateway::Device do
|
|
|
65
70
|
|
|
66
71
|
ret = @gw.list
|
|
67
72
|
expect(ret).to eq(body)
|
|
73
|
+
|
|
74
|
+
WebMock.reset!
|
|
68
75
|
end
|
|
69
76
|
|
|
70
77
|
it 'lists with limit' do
|
|
@@ -89,6 +96,8 @@ RSpec.describe MrMurano::Gateway::Device do
|
|
|
89
96
|
|
|
90
97
|
ret = @gw.list(1)
|
|
91
98
|
expect(ret).to eq(body)
|
|
99
|
+
|
|
100
|
+
WebMock.reset!
|
|
92
101
|
end
|
|
93
102
|
|
|
94
103
|
it 'lists with before' do
|
|
@@ -136,6 +145,8 @@ RSpec.describe MrMurano::Gateway::Device do
|
|
|
136
145
|
|
|
137
146
|
ret = @gw.fetch(58)
|
|
138
147
|
expect(ret).to eq(body)
|
|
148
|
+
|
|
149
|
+
WebMock.reset!
|
|
139
150
|
end
|
|
140
151
|
|
|
141
152
|
it 'enables one' do
|
|
@@ -158,6 +169,8 @@ RSpec.describe MrMurano::Gateway::Device do
|
|
|
158
169
|
|
|
159
170
|
ret = @gw.enable(58)
|
|
160
171
|
expect(ret).to eq(body)
|
|
172
|
+
|
|
173
|
+
WebMock.reset!
|
|
161
174
|
end
|
|
162
175
|
|
|
163
176
|
it 'enables with options' do
|
|
@@ -180,6 +193,8 @@ RSpec.describe MrMurano::Gateway::Device do
|
|
|
180
193
|
|
|
181
194
|
ret = @gw.enable(58, type: :certificate, expire: '123456')
|
|
182
195
|
expect(ret).to eq(body)
|
|
196
|
+
|
|
197
|
+
WebMock.reset!
|
|
183
198
|
end
|
|
184
199
|
|
|
185
200
|
it 'enables with extra options' do
|
|
@@ -202,6 +217,8 @@ RSpec.describe MrMurano::Gateway::Device do
|
|
|
202
217
|
|
|
203
218
|
ret = @gw.enable(58, go: :blueteam, type: :certificate, expire: 123_456, bob: :built)
|
|
204
219
|
expect(ret).to eq(body)
|
|
220
|
+
|
|
221
|
+
WebMock.reset!
|
|
205
222
|
end
|
|
206
223
|
|
|
207
224
|
it 'removes one' do
|
|
@@ -224,6 +241,8 @@ RSpec.describe MrMurano::Gateway::Device do
|
|
|
224
241
|
|
|
225
242
|
ret = @gw.remove(58)
|
|
226
243
|
expect(ret).to eq(body)
|
|
244
|
+
|
|
245
|
+
WebMock.reset!
|
|
227
246
|
end
|
|
228
247
|
|
|
229
248
|
context 'activates' do
|
|
@@ -236,6 +255,11 @@ RSpec.describe MrMurano::Gateway::Device do
|
|
|
236
255
|
'https://bizapi.hosted.exosite.io/api:1/service/XYZ/device2'
|
|
237
256
|
).to_return(body: { fqdn: 'xxxxx.m2.exosite-staging.io' }.to_json)
|
|
238
257
|
end
|
|
258
|
+
|
|
259
|
+
after(:example) do
|
|
260
|
+
WebMock.reset!
|
|
261
|
+
end
|
|
262
|
+
|
|
239
263
|
it 'succeeds' do
|
|
240
264
|
stub_request(
|
|
241
265
|
:post,
|
|
@@ -255,11 +279,11 @@ RSpec.describe MrMurano::Gateway::Device do
|
|
|
255
279
|
saved = $stderr
|
|
256
280
|
$stderr = StringIO.new
|
|
257
281
|
|
|
258
|
-
#@gw.activate(58)
|
|
259
|
-
#expect($stderr.string).to eq("\e[31mRequest Failed: 409: nil\e[0m\n")
|
|
260
282
|
expect do
|
|
261
283
|
@gw.activate(58)
|
|
262
|
-
end.to raise_error(SystemExit).and output(
|
|
284
|
+
end.to raise_error(SystemExit).and output(
|
|
285
|
+
"\e[31mThe specified device is already activated.\e[0m\n"
|
|
286
|
+
).to_stderr
|
|
263
287
|
$stderr = saved
|
|
264
288
|
end
|
|
265
289
|
|
|
@@ -288,6 +312,7 @@ RSpec.describe MrMurano::Gateway::Device do
|
|
|
288
312
|
request.body.to_s =~ %r{Content-Type: text/csv\r\n\r\nID\r?\n1\r?\n2\r?\n3\r?\n4\r?\n5}
|
|
289
313
|
end
|
|
290
314
|
@gw.enable_batch('ids.csv')
|
|
315
|
+
WebMock.reset!
|
|
291
316
|
end
|
|
292
317
|
|
|
293
318
|
it 'but file is missing' do
|
|
@@ -303,8 +328,11 @@ RSpec.describe MrMurano::Gateway::Device do
|
|
|
303
328
|
saved = $stderr
|
|
304
329
|
$stderr = StringIO.new
|
|
305
330
|
@gw.enable_batch('ids.csv')
|
|
306
|
-
expect($stderr.string).to eq(
|
|
331
|
+
expect($stderr.string).to eq(
|
|
332
|
+
%(\e[31mRequest Failed: 400: CSV file format invalid\e[0m\n)
|
|
333
|
+
)
|
|
307
334
|
$stderr = saved
|
|
335
|
+
WebMock.reset!
|
|
308
336
|
end
|
|
309
337
|
|
|
310
338
|
it 'but file is missing header' do
|
|
@@ -318,8 +346,11 @@ RSpec.describe MrMurano::Gateway::Device do
|
|
|
318
346
|
saved = $stderr
|
|
319
347
|
$stderr = StringIO.new
|
|
320
348
|
@gw.enable_batch('ids.csv')
|
|
321
|
-
expect($stderr.string).to eq(
|
|
349
|
+
expect($stderr.string).to eq(
|
|
350
|
+
%(\e[31mRequest Failed: 400: CSV file format invalid\e[0m\n)
|
|
351
|
+
)
|
|
322
352
|
$stderr = saved
|
|
353
|
+
WebMock.reset!
|
|
323
354
|
end
|
|
324
355
|
end
|
|
325
356
|
|
|
@@ -332,6 +363,8 @@ RSpec.describe MrMurano::Gateway::Device do
|
|
|
332
363
|
|
|
333
364
|
ret = @gw.read(56)
|
|
334
365
|
expect(ret).to eq(body)
|
|
366
|
+
|
|
367
|
+
WebMock.reset!
|
|
335
368
|
end
|
|
336
369
|
|
|
337
370
|
context 'writes state' do
|
|
@@ -343,6 +376,8 @@ RSpec.describe MrMurano::Gateway::Device do
|
|
|
343
376
|
).with(body: body.to_json)
|
|
344
377
|
|
|
345
378
|
@gw.write(56, bob: 'fuzz')
|
|
379
|
+
|
|
380
|
+
WebMock.reset!
|
|
346
381
|
end
|
|
347
382
|
|
|
348
383
|
it 'fails' do
|
|
@@ -356,8 +391,12 @@ RSpec.describe MrMurano::Gateway::Device do
|
|
|
356
391
|
$stderr = StringIO.new
|
|
357
392
|
|
|
358
393
|
@gw.write(56, bob: 'fuzz')
|
|
359
|
-
expect($stderr.string).to eq(
|
|
394
|
+
expect($stderr.string).to eq(
|
|
395
|
+
"\e[31mRequest Failed: 400: Value is not settable\e[0m\n"
|
|
396
|
+
)
|
|
360
397
|
$stderr = saved
|
|
398
|
+
|
|
399
|
+
WebMock.reset!
|
|
361
400
|
end
|
|
362
401
|
end
|
|
363
402
|
end
|
|
@@ -17,8 +17,8 @@ require 'HttpAuthed_spec'
|
|
|
17
17
|
|
|
18
18
|
RSpec.describe MrMurano::Gateway::Resources do
|
|
19
19
|
include_context 'WORKSPACE'
|
|
20
|
+
|
|
20
21
|
before(:example) do
|
|
21
|
-
MrMurano::SyncRoot.instance.reset
|
|
22
22
|
$cfg = MrMurano::Config.new
|
|
23
23
|
$cfg.load
|
|
24
24
|
$cfg['net.host'] = 'bizapi.hosted.exosite.io'
|
|
@@ -15,8 +15,8 @@ require 'HttpAuthed_spec'
|
|
|
15
15
|
|
|
16
16
|
RSpec.describe MrMurano::Gateway::Settings do
|
|
17
17
|
include_context 'WORKSPACE'
|
|
18
|
+
|
|
18
19
|
before(:example) do
|
|
19
|
-
MrMurano::SyncRoot.instance.reset
|
|
20
20
|
$cfg = MrMurano::Config.new
|
|
21
21
|
$cfg.load
|
|
22
22
|
$cfg['net.host'] = 'bizapi.hosted.exosite.io'
|
data/spec/HttpAuthed_spec.rb
CHANGED
|
@@ -14,6 +14,10 @@ require 'MrMurano/HttpAuthed'
|
|
|
14
14
|
# MuranoCLI/spec/HttpAuthed_spec.rb:10: warning: previous definition of
|
|
15
15
|
# stub_request_email_password_from_cfg was here
|
|
16
16
|
|
|
17
|
+
unless defined? LEGIT_LOOKING_TOKEN
|
|
18
|
+
LEGIT_LOOKING_TOKEN = '0123456789ABCDEF0123456789ABCDEF01234567'
|
|
19
|
+
end
|
|
20
|
+
|
|
17
21
|
unless defined? stub_request_email_password_from_cfg
|
|
18
22
|
def stub_request_email_password_from_cfg
|
|
19
23
|
stub_request(
|
|
@@ -26,7 +30,7 @@ unless defined? stub_request_email_password_from_cfg
|
|
|
26
30
|
}.to_json
|
|
27
31
|
).to_return(
|
|
28
32
|
status: 200,
|
|
29
|
-
body: { token:
|
|
33
|
+
body: { token: LEGIT_LOOKING_TOKEN }.to_json,
|
|
30
34
|
headers: {}
|
|
31
35
|
)
|
|
32
36
|
end
|
|
@@ -44,7 +48,7 @@ unless defined? stub_request_email_password_from_bob
|
|
|
44
48
|
}.to_json
|
|
45
49
|
).to_return(
|
|
46
50
|
status: 200,
|
|
47
|
-
body: { token:
|
|
51
|
+
body: { token: LEGIT_LOOKING_TOKEN }.to_json,
|
|
48
52
|
headers: {}
|
|
49
53
|
)
|
|
50
54
|
end
|
|
@@ -54,7 +58,7 @@ unless defined? stub_request_token_verification
|
|
|
54
58
|
def stub_request_token_verification
|
|
55
59
|
stub_request(
|
|
56
60
|
:get,
|
|
57
|
-
"#{$cfg['net.protocol']}://#{$cfg['net.host']}/api:1/token
|
|
61
|
+
"#{$cfg['net.protocol']}://#{$cfg['net.host']}/api:1/token/#{LEGIT_LOOKING_TOKEN}"
|
|
58
62
|
).to_return(
|
|
59
63
|
status: 200,
|
|
60
64
|
body: {}.to_json,
|
|
@@ -71,3 +75,13 @@ unless defined? stub_request_email_password
|
|
|
71
75
|
end
|
|
72
76
|
end
|
|
73
77
|
|
|
78
|
+
unless defined? create_instance_double_passwords
|
|
79
|
+
def create_instance_double_passwords
|
|
80
|
+
pswd = instance_double('MrMurano::Passwords')
|
|
81
|
+
allow(pswd).to receive(:load).and_return(nil)
|
|
82
|
+
allow(pswd).to receive(:save).and_return(nil)
|
|
83
|
+
allow(MrMurano::Passwords).to receive(:new).and_return(pswd)
|
|
84
|
+
pswd
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
|
data/spec/ProjectFile_spec.rb
CHANGED
|
@@ -5,9 +5,7 @@
|
|
|
5
5
|
# vim:tw=0:ts=2:sw=2:et:ai
|
|
6
6
|
# Unauthorized copying of this file is strictly prohibited.
|
|
7
7
|
|
|
8
|
-
#require 'erb'
|
|
9
8
|
require 'fileutils'
|
|
10
|
-
#require 'tempfile'
|
|
11
9
|
require 'MrMurano/version'
|
|
12
10
|
require 'MrMurano/Config'
|
|
13
11
|
require 'MrMurano/ProjectFile'
|
|
@@ -32,7 +30,9 @@ RSpec.describe MrMurano::ProjectFile do
|
|
|
32
30
|
it 'Info' do
|
|
33
31
|
expect(@pjf.get('info.name')).to eq('project')
|
|
34
32
|
expect(@pjf.get('info.summary')).to eq('One line summary of project')
|
|
35
|
-
expect(@pjf.get('info.description')).to eq(
|
|
33
|
+
expect(@pjf.get('info.description')).to eq(
|
|
34
|
+
"In depth description of project\n\nWith lots of details."
|
|
35
|
+
)
|
|
36
36
|
expect(@pjf.get('info.authors')).to eq(['bob@builder.co'])
|
|
37
37
|
expect(@pjf.get('info.version')).to eq('1.0.0')
|
|
38
38
|
end
|
|
@@ -40,55 +40,85 @@ RSpec.describe MrMurano::ProjectFile do
|
|
|
40
40
|
it 'Assets' do
|
|
41
41
|
# Because defaults before load() are all nil, the default_value_for method
|
|
42
42
|
# is called.
|
|
43
|
-
expect(@pjf).to receive(
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
expect(@pjf
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
43
|
+
expect(@pjf).to receive(
|
|
44
|
+
:default_value_for
|
|
45
|
+
).with('assets.location').and_return('here')
|
|
46
|
+
expect(@pjf.get(
|
|
47
|
+
'assets.location'
|
|
48
|
+
)).to eq('here')
|
|
49
|
+
|
|
50
|
+
expect(@pjf).to receive(
|
|
51
|
+
:default_value_for
|
|
52
|
+
).with('assets.include').and_return(['here'])
|
|
53
|
+
expect(@pjf.get(
|
|
54
|
+
'assets.include'
|
|
55
|
+
)).to eq(['here'])
|
|
56
|
+
|
|
57
|
+
expect(@pjf).to receive(
|
|
58
|
+
:default_value_for
|
|
59
|
+
).with('assets.exclude').and_return(['here'])
|
|
50
60
|
expect(@pjf.get('assets.exclude')).to eq(['here'])
|
|
51
61
|
|
|
52
|
-
expect(@pjf).to receive(
|
|
62
|
+
expect(@pjf).to receive(
|
|
63
|
+
:default_value_for
|
|
64
|
+
).with('assets.default_page').and_return('here')
|
|
53
65
|
expect(@pjf.get('assets.default_page')).to eq('here')
|
|
54
66
|
end
|
|
55
67
|
|
|
56
68
|
it 'Modules' do
|
|
57
69
|
# Because defaults before load() are all nil, the default_value_for method
|
|
58
70
|
# is called.
|
|
59
|
-
expect(@pjf).to receive(
|
|
71
|
+
expect(@pjf).to receive(
|
|
72
|
+
:default_value_for
|
|
73
|
+
).with('modules.location').and_return('here')
|
|
60
74
|
expect(@pjf.get('modules.location')).to eq('here')
|
|
61
75
|
|
|
62
|
-
expect(@pjf).to receive(
|
|
76
|
+
expect(@pjf).to receive(
|
|
77
|
+
:default_value_for
|
|
78
|
+
).with('modules.include').and_return(['here'])
|
|
63
79
|
expect(@pjf.get('modules.include')).to eq(['here'])
|
|
64
80
|
|
|
65
|
-
expect(@pjf).to receive(
|
|
81
|
+
expect(@pjf).to receive(
|
|
82
|
+
:default_value_for
|
|
83
|
+
).with('modules.exclude').and_return(['here'])
|
|
66
84
|
expect(@pjf.get('modules.exclude')).to eq(['here'])
|
|
67
85
|
end
|
|
68
86
|
|
|
69
87
|
it 'Routes' do
|
|
70
88
|
# Because defaults before load() are all nil, the default_value_for method
|
|
71
89
|
# is called.
|
|
72
|
-
expect(@pjf).to receive(
|
|
90
|
+
expect(@pjf).to receive(
|
|
91
|
+
:default_value_for
|
|
92
|
+
).with('routes.location').and_return('here')
|
|
73
93
|
expect(@pjf.get('routes.location')).to eq('here')
|
|
74
94
|
|
|
75
|
-
expect(@pjf).to receive(
|
|
95
|
+
expect(@pjf).to receive(
|
|
96
|
+
:default_value_for
|
|
97
|
+
).with('routes.include').and_return(['here'])
|
|
76
98
|
expect(@pjf.get('routes.include')).to eq(['here'])
|
|
77
99
|
|
|
78
|
-
expect(@pjf).to receive(
|
|
100
|
+
expect(@pjf).to receive(
|
|
101
|
+
:default_value_for
|
|
102
|
+
).with('routes.exclude').and_return(['here'])
|
|
79
103
|
expect(@pjf.get('routes.exclude')).to eq(['here'])
|
|
80
104
|
end
|
|
81
105
|
|
|
82
106
|
it 'Services' do
|
|
83
107
|
# Because defaults before load() are all nil, the default_value_for method
|
|
84
108
|
# is called.
|
|
85
|
-
expect(@pjf).to receive(
|
|
109
|
+
expect(@pjf).to receive(
|
|
110
|
+
:default_value_for
|
|
111
|
+
).with('services.location').and_return('here')
|
|
86
112
|
expect(@pjf.get('services.location')).to eq('here')
|
|
87
113
|
|
|
88
|
-
expect(@pjf).to receive(
|
|
114
|
+
expect(@pjf).to receive(
|
|
115
|
+
:default_value_for
|
|
116
|
+
).with('services.include').and_return(['here'])
|
|
89
117
|
expect(@pjf.get('services.include')).to eq(['here'])
|
|
90
118
|
|
|
91
|
-
expect(@pjf).to receive(
|
|
119
|
+
expect(@pjf).to receive(
|
|
120
|
+
:default_value_for
|
|
121
|
+
).with('services.exclude').and_return(['here'])
|
|
92
122
|
expect(@pjf.get('services.exclude')).to eq(['here'])
|
|
93
123
|
end
|
|
94
124
|
end
|
|
@@ -135,8 +165,12 @@ RSpec.describe MrMurano::ProjectFile do
|
|
|
135
165
|
expect($cfg).to receive(:get).with('endpoints.searchFor').and_return('beef')
|
|
136
166
|
expect(@pjf.default_value_for('routes.include')).to eq(['beef'])
|
|
137
167
|
|
|
138
|
-
expect($cfg).to receive(:get).with(
|
|
139
|
-
|
|
168
|
+
expect($cfg).to receive(:get).with(
|
|
169
|
+
'endpoints.searchFor'
|
|
170
|
+
).and_return('beef and potatoes')
|
|
171
|
+
expect(@pjf.default_value_for(
|
|
172
|
+
'routes.include'
|
|
173
|
+
)).to eq(%w[beef and potatoes])
|
|
140
174
|
end
|
|
141
175
|
end
|
|
142
176
|
end
|
|
@@ -161,7 +195,9 @@ RSpec.describe MrMurano::ProjectFile do
|
|
|
161
195
|
end
|
|
162
196
|
|
|
163
197
|
it 'fails back to $cfg' do
|
|
164
|
-
expect(@pjf).to receive(
|
|
198
|
+
expect(@pjf).to receive(
|
|
199
|
+
:default_value_for
|
|
200
|
+
).with('routes.include').and_return(['here'])
|
|
165
201
|
expect(@pjf.get('routes.include')).to eq(['here'])
|
|
166
202
|
end
|
|
167
203
|
end
|
data/spec/Setting_spec.rb
CHANGED
|
@@ -26,14 +26,15 @@ module ::MrMurano
|
|
|
26
26
|
end
|
|
27
27
|
end
|
|
28
28
|
end
|
|
29
|
+
|
|
29
30
|
module Testsettwo
|
|
30
31
|
end
|
|
31
32
|
end
|
|
32
33
|
|
|
33
34
|
RSpec.describe MrMurano::Setting do
|
|
34
35
|
include_context 'WORKSPACE'
|
|
36
|
+
|
|
35
37
|
before(:example) do
|
|
36
|
-
MrMurano::SyncRoot.instance.reset
|
|
37
38
|
$cfg = MrMurano::Config.new
|
|
38
39
|
$cfg.load
|
|
39
40
|
$cfg['net.host'] = 'bizapi.hosted.exosite.io'
|