MuranoCLI 3.0.2 → 3.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +30 -59
- data/Gemfile +9 -3
- data/MuranoCLI.gemspec +11 -4
- data/bin/murano +2 -90
- data/lib/MrMurano.rb +5 -1
- data/lib/MrMurano/{spec_commander.rb → Commander-Entry.rb} +1 -2
- data/lib/MrMurano/Solution.rb +12 -15
- data/lib/MrMurano/SolutionId.rb +1 -5
- data/lib/MrMurano/SyncAllowed.rb +2 -2
- data/lib/MrMurano/SyncUpDown.rb +6 -3
- data/lib/MrMurano/progress.rb +11 -2
- data/lib/MrMurano/verbosing.rb +3 -2
- data/lib/MrMurano/version.rb +2 -2
- data/spec/Account-Passwords_spec.rb +34 -48
- data/spec/Account_spec.rb +58 -63
- data/spec/Business_spec.rb +151 -139
- data/spec/ConfigFile_spec.rb +15 -11
- data/spec/ConfigMigrate_spec.rb +23 -12
- data/spec/Config_spec.rb +57 -54
- data/spec/Content_spec.rb +233 -201
- data/spec/GatewayBase_spec.rb +35 -27
- data/spec/GatewayDevice_spec.rb +149 -149
- data/spec/GatewayResource_spec.rb +115 -102
- data/spec/GatewaySettings_spec.rb +69 -62
- data/spec/Http_spec.rb +66 -56
- data/spec/MakePretties_spec.rb +82 -73
- data/spec/Mock_spec.rb +38 -29
- data/spec/ProjectFile_spec.rb +118 -106
- data/spec/Setting_spec.rb +24 -15
- data/spec/Solution-ServiceConfig_spec.rb +168 -140
- data/spec/Solution-ServiceEventHandler_spec.rb +186 -188
- data/spec/Solution-ServiceModules_spec.rb +314 -232
- data/spec/Solution-UsersRoles_spec.rb +136 -86
- data/spec/Solution_spec.rb +78 -50
- data/spec/SyncRoot_spec.rb +26 -24
- data/spec/SyncUpDown_spec.rb +268 -249
- data/spec/Verbosing_spec.rb +95 -93
- data/spec/Webservice-Cors_spec.rb +141 -95
- data/spec/Webservice-Endpoint_spec.rb +382 -346
- data/spec/Webservice-File_spec.rb +148 -109
- data/spec/Webservice-Setting_spec.rb +47 -41
- data/spec/cmd_business_spec.rb +17 -17
- data/spec/cmd_common.rb +27 -7
- data/spec/cmd_config_spec.rb +31 -20
- data/spec/cmd_content_spec.rb +80 -68
- data/spec/cmd_cors_spec.rb +11 -5
- data/spec/cmd_device_spec.rb +16 -14
- data/spec/cmd_domain_spec.rb +10 -8
- data/spec/cmd_exchange_spec.rb +3 -3
- data/spec/cmd_init_spec.rb +100 -101
- data/spec/cmd_keystore_spec.rb +17 -12
- data/spec/cmd_link_spec.rb +22 -37
- data/spec/cmd_password_spec.rb +11 -7
- data/spec/cmd_setting_application_spec.rb +47 -33
- data/spec/cmd_setting_product_spec.rb +32 -27
- data/spec/cmd_status_spec.rb +125 -114
- data/spec/cmd_syncdown_spec.rb +70 -65
- data/spec/cmd_syncup_spec.rb +19 -15
- data/spec/cmd_usage_spec.rb +14 -10
- metadata +29 -15
data/spec/Business_spec.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
# Last Modified: 2017.09.
|
1
|
+
# Last Modified: 2017.09.12 /coding: utf-8
|
2
|
+
# frozen_string_literal: true
|
2
3
|
|
3
4
|
# Copyright © 2016-2017 Exosite LLC.
|
4
5
|
# License: MIT. See LICENSE.txt.
|
@@ -13,7 +14,7 @@ require '_workspace'
|
|
13
14
|
MISSING_BIZ_ID_MSG = MrMurano::Business.missing_business_id_msg
|
14
15
|
|
15
16
|
RSpec.describe MrMurano::Business do
|
16
|
-
include_context
|
17
|
+
include_context 'WORKSPACE'
|
17
18
|
before(:example) do
|
18
19
|
@saved_cfg = ENV['MURANO_CONFIGFILE']
|
19
20
|
ENV['MURANO_CONFIGFILE'] = nil
|
@@ -24,33 +25,34 @@ RSpec.describe MrMurano::Business do
|
|
24
25
|
$cfg['product.id'] = 'XYZ'
|
25
26
|
|
26
27
|
@biz = MrMurano::Business.new
|
27
|
-
allow(@biz).to receive(:token).and_return(
|
28
|
+
allow(@biz).to receive(:token).and_return('TTTTTTTTTT')
|
28
29
|
end
|
29
30
|
after(:example) do
|
30
31
|
ENV['MURANO_CONFIGFILE'] = @saved_cfg
|
31
32
|
end
|
32
33
|
|
33
|
-
it
|
34
|
+
it 'lists products' do
|
34
35
|
prodlist = [
|
35
|
-
{bizid:
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
{bizid:
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
36
|
+
{ bizid: 'XYZxyz',
|
37
|
+
type: 'product',
|
38
|
+
pid: 'ABC',
|
39
|
+
modelId: 'cde',
|
40
|
+
label: 'fts',
|
41
|
+
api_id: 'XYZ',
|
42
|
+
sid: 'XYZ',
|
43
|
+
name: 'XYZ', },
|
44
|
+
{ bizid: 'XYZxyz',
|
45
|
+
type: 'product',
|
46
|
+
pid: 'fgh',
|
47
|
+
modelId: 'ijk',
|
48
|
+
label: 'lua-test',
|
49
|
+
api_id: 'XYZ',
|
50
|
+
sid: 'XYZ',
|
51
|
+
name: 'XYZ', },
|
51
52
|
]
|
52
|
-
stub_request(
|
53
|
-
|
53
|
+
stub_request(
|
54
|
+
:get, 'https://bizapi.hosted.exosite.io/api:1/business/XYZxyz/solution/'
|
55
|
+
).to_return(body: prodlist)
|
54
56
|
|
55
57
|
solz = []
|
56
58
|
solz << MrMurano::Product.new(prodlist[0])
|
@@ -60,78 +62,77 @@ RSpec.describe MrMurano::Business do
|
|
60
62
|
expect(ret).to eq(solz)
|
61
63
|
end
|
62
64
|
|
63
|
-
it
|
65
|
+
it 'lists products; without biz.id' do
|
64
66
|
allow($cfg).to receive(:get).with('business.id').and_return(nil)
|
65
|
-
expect(@biz).to receive(:debug).with(
|
67
|
+
expect(@biz).to receive(:debug).with('Getting all solutions of type product')
|
66
68
|
expect { @biz.products }.to raise_error(MISSING_BIZ_ID_MSG)
|
67
69
|
end
|
68
70
|
|
69
|
-
it
|
70
|
-
# LATER: Re-enable using
|
71
|
+
it 'creates product' do
|
72
|
+
# LATER: Re-enable using 'ONe' instead of 'one' after upcase fixed in pegasus_registry.
|
71
73
|
stub_request(
|
72
|
-
:post,
|
74
|
+
:post, 'https://bizapi.hosted.exosite.io/api:1/business/XYZxyz/solution/'
|
73
75
|
).with(
|
74
76
|
body: { label: 'one', type: 'product' }
|
75
77
|
).to_return(body: '{"id": "abc123def456ghi78", "name": "one"}')
|
76
78
|
|
77
|
-
prod = @biz.new_product(
|
79
|
+
prod = @biz.new_product('one')
|
78
80
|
expect(prod.valid?).to be true
|
79
81
|
end
|
80
82
|
|
81
|
-
it
|
83
|
+
it 'creates product; without biz.id' do
|
82
84
|
allow($cfg).to receive(:get).with('business.id').and_return(nil)
|
83
|
-
# LATER: Re-enable using
|
84
|
-
expect { @biz.new_product(
|
85
|
+
# LATER: Re-enable using 'ONe' instead of 'one' after upcase fixed in pegasus_registry.
|
86
|
+
expect { @biz.new_product('one') }.to raise_error(MISSING_BIZ_ID_MSG)
|
85
87
|
end
|
86
88
|
|
87
|
-
it
|
88
|
-
# LATER: Re-enable using
|
89
|
-
stub_request(
|
90
|
-
|
89
|
+
it 'deletes product' do
|
90
|
+
# LATER: Re-enable using 'ONe' instead of 'one' after upcase fixed in pegasus_registry.
|
91
|
+
stub_request(
|
92
|
+
:delete, 'https://bizapi.hosted.exosite.io/api:1/business/XYZxyz/solution/one'
|
93
|
+
).to_return(body: '')
|
91
94
|
|
92
|
-
ret = @biz.delete_product(
|
95
|
+
ret = @biz.delete_product('one')
|
93
96
|
expect(ret).to eq({})
|
94
97
|
end
|
95
98
|
|
96
|
-
it
|
99
|
+
it 'deletes product; without biz.id' do
|
97
100
|
allow($cfg).to receive(:get).with('business.id').and_return(nil)
|
98
|
-
# LATER: Re-enable using
|
99
|
-
expect { @biz.delete_product(
|
101
|
+
# LATER: Re-enable using 'ONe' instead of 'one' after upcase fixed in pegasus_registry.
|
102
|
+
expect { @biz.delete_product('one') }.to raise_error(MISSING_BIZ_ID_MSG)
|
100
103
|
end
|
101
104
|
|
102
105
|
# *** :applications type solutions
|
103
106
|
|
104
|
-
it
|
107
|
+
it 'lists applications' do
|
105
108
|
# NOTE: Need to use symbols, not strings, for keys, because
|
106
109
|
# http.rb::json_opts() specifies :symbolize_names => true.
|
107
110
|
appllist = [
|
108
|
-
{bizid:
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
name: "lmn",
|
121
|
-
},
|
111
|
+
{ bizid: 'XYZxyz',
|
112
|
+
type: 'application',
|
113
|
+
domain: 'XYZxyz.apps.exosite.io',
|
114
|
+
api_id: 'ACBabc',
|
115
|
+
sid: 'ACBabc',
|
116
|
+
name: 'ijk', },
|
117
|
+
{ bizid: 'XYZxyz',
|
118
|
+
type: 'application',
|
119
|
+
domain: 'XYZxyz.apps.exosite.io',
|
120
|
+
api_id: 'DEFdef',
|
121
|
+
sid: 'DEFdef',
|
122
|
+
name: 'lmn', },
|
122
123
|
]
|
123
124
|
solnlist = [
|
124
|
-
{bizid:
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
},
|
125
|
+
{ bizid: 'XYZxyz',
|
126
|
+
type: 'product',
|
127
|
+
pid: 'ABC',
|
128
|
+
modelId: 'cde',
|
129
|
+
label: 'fts',
|
130
|
+
name: 'fgh', },
|
131
131
|
]
|
132
132
|
solnlist.concat appllist
|
133
|
-
stub_request(
|
134
|
-
|
133
|
+
stub_request(
|
134
|
+
:get, 'https://bizapi.hosted.exosite.io/api:1/business/XYZxyz/solution/'
|
135
|
+
).to_return(body: solnlist)
|
135
136
|
|
136
137
|
solz = []
|
137
138
|
#solz << MrMurano::Product.new(solnlist[0])
|
@@ -142,66 +143,68 @@ RSpec.describe MrMurano::Business do
|
|
142
143
|
expect(ret).to eq(solz)
|
143
144
|
end
|
144
145
|
|
145
|
-
it
|
146
|
+
it 'lists applications; without biz.id' do
|
146
147
|
allow($cfg).to receive(:get).with('business.id').and_return(nil)
|
147
|
-
expect(@biz).to receive(:debug).with(
|
148
|
+
expect(@biz).to receive(:debug).with('Getting all solutions of type application')
|
148
149
|
expect { @biz.applications }.to raise_error(MISSING_BIZ_ID_MSG)
|
149
150
|
end
|
150
151
|
|
151
|
-
it
|
152
|
-
# LATER: Re-enable using
|
153
|
-
stub_request(
|
154
|
-
|
155
|
-
|
152
|
+
it 'creates application' do
|
153
|
+
# LATER: Re-enable using 'ONe' instead of 'one' after upcase fixed in pegasus_registry.
|
154
|
+
stub_request(
|
155
|
+
:post, 'https://bizapi.hosted.exosite.io/api:1/business/XYZxyz/solution/'
|
156
|
+
).with(
|
157
|
+
body: { label: 'one', type: 'application' }
|
158
|
+
).to_return(body: '{"id": "abc123def456ghi78", "name": "one"}')
|
156
159
|
|
157
|
-
appl = @biz.new_application(
|
160
|
+
appl = @biz.new_application('one')
|
158
161
|
expect(appl.valid?).to be true
|
159
162
|
end
|
160
163
|
|
161
|
-
it
|
164
|
+
it 'creates application; without biz.id' do
|
162
165
|
allow($cfg).to receive(:get).with('business.id').and_return(nil)
|
163
|
-
# LATER: Re-enable using
|
164
|
-
expect { @biz.new_application(
|
166
|
+
# LATER: Re-enable using 'ONe' instead of 'one' after upcase fixed in pegasus_registry.
|
167
|
+
expect { @biz.new_application('one') }.to raise_error(MISSING_BIZ_ID_MSG)
|
165
168
|
end
|
166
169
|
|
167
|
-
it
|
168
|
-
stub_request(
|
169
|
-
|
170
|
+
it 'deletes application' do
|
171
|
+
stub_request(
|
172
|
+
:delete, 'https://bizapi.hosted.exosite.io/api:1/business/XYZxyz/solution/ONe'
|
173
|
+
).to_return(body: '')
|
170
174
|
|
171
|
-
ret = @biz.delete_application(
|
175
|
+
ret = @biz.delete_application('ONe')
|
172
176
|
expect(ret).to eq({})
|
173
177
|
end
|
174
178
|
|
175
|
-
it
|
179
|
+
it 'deletes application; without biz.id' do
|
176
180
|
allow($cfg).to receive(:get).with('business.id').and_return(nil)
|
177
|
-
expect { @biz.delete_application(
|
181
|
+
expect { @biz.delete_application('ONe') }.to raise_error(MISSING_BIZ_ID_MSG)
|
178
182
|
end
|
179
183
|
|
180
184
|
# *** :all type solutions
|
181
185
|
|
182
|
-
it
|
186
|
+
it 'lists solutions' do
|
183
187
|
# http.rb::json_opts() sets :symbolize_names=>true, so use symbols, not strings.
|
184
188
|
prodlist = [
|
185
|
-
{bizid:
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
},
|
189
|
+
{ bizid: 'XYZxyz',
|
190
|
+
type: 'product',
|
191
|
+
domain: 'ABCabc.m2.exosite.io',
|
192
|
+
api_id: 'ABCabc',
|
193
|
+
sid: 'ABCabc',
|
194
|
+
name: 'XXX', },
|
192
195
|
]
|
193
196
|
appllist = [
|
194
|
-
{bizid:
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
},
|
197
|
+
{ bizid: 'XYZxyz',
|
198
|
+
type: 'application',
|
199
|
+
domain: 'XYZxyz.apps.exosite.io',
|
200
|
+
api_id: 'DEFdef',
|
201
|
+
sid: 'DEFdef',
|
202
|
+
name: 'XXX', },
|
201
203
|
]
|
202
204
|
solnlist = prodlist + appllist
|
203
|
-
stub_request(
|
204
|
-
|
205
|
+
stub_request(
|
206
|
+
:get, 'https://bizapi.hosted.exosite.io/api:1/business/XYZxyz/solution/'
|
207
|
+
).to_return(body: solnlist)
|
205
208
|
|
206
209
|
solz = []
|
207
210
|
solz << MrMurano::Product.new(prodlist[0])
|
@@ -211,82 +214,91 @@ RSpec.describe MrMurano::Business do
|
|
211
214
|
expect(solz).to eq(solz)
|
212
215
|
end
|
213
216
|
|
214
|
-
it
|
217
|
+
it 'lists solutions; without biz.id' do
|
215
218
|
allow($cfg).to receive(:get).with('business.id').and_return(nil)
|
216
|
-
expect(@biz).to receive(:debug).with(
|
219
|
+
expect(@biz).to receive(:debug).with('Getting all solutions of type all')
|
217
220
|
expect { @biz.solutions }.to raise_error(MISSING_BIZ_ID_MSG)
|
218
221
|
end
|
219
222
|
|
220
|
-
it
|
221
|
-
stub_request(
|
222
|
-
|
223
|
-
|
223
|
+
it 'creates solution' do
|
224
|
+
stub_request(
|
225
|
+
:post, 'https://bizapi.hosted.exosite.io/api:1/business/XYZxyz/solution/'
|
226
|
+
).with(body: { label: 'one', type: 'product' })
|
227
|
+
.to_return(body: '{"id": "abc123def456ghi78", "name": "one"}')
|
224
228
|
|
225
|
-
sol = @biz.new_solution!(
|
229
|
+
sol = @biz.new_solution!('one', :product)
|
226
230
|
expect(sol.valid?).to be true
|
227
|
-
expect(sol.api_id).to eq(
|
231
|
+
expect(sol.api_id).to eq('abc123def456ghi78')
|
228
232
|
end
|
229
233
|
|
230
|
-
|
231
|
-
if
|
234
|
+
still_broken = true
|
235
|
+
if still_broken
|
232
236
|
# LATER: Re-enable after upcase fixed in pegasus_registry.
|
233
|
-
it
|
237
|
+
it 'creates solution; with upper case' do
|
234
238
|
# 2017-07-03: Murano appears to return the id nowadays, so added body.
|
235
|
-
stub_request(
|
236
|
-
|
237
|
-
|
239
|
+
stub_request(
|
240
|
+
:post, 'https://bizapi.hosted.exosite.io/api:1/business/XYZxyz/solution/'
|
241
|
+
).with(body: { label: 'ONe', type: 'product' })
|
242
|
+
.to_return(body: '{"id": "abc123def456ghi78", "name": "ONe"}')
|
238
243
|
|
239
|
-
expect { @biz.new_solution!(
|
244
|
+
expect { @biz.new_solution!('ONe', :product) }.to_not raise_error
|
240
245
|
end
|
241
246
|
else
|
242
|
-
it
|
243
|
-
expect { @biz.new_solution!(
|
244
|
-
MrMurano::Product.new.name_validate_help
|
247
|
+
it 'creates solution; with uppercase' do
|
248
|
+
expect { @biz.new_solution!('oNeTWO', :product) }.to raise_error(
|
249
|
+
MrMurano::Product.new.name_validate_help
|
250
|
+
)
|
245
251
|
end
|
246
252
|
end
|
247
253
|
|
248
|
-
it
|
249
|
-
stub_request(
|
250
|
-
|
251
|
-
|
254
|
+
it 'creates solution; with numbers and dashes' do
|
255
|
+
stub_request(
|
256
|
+
:post, 'https://bizapi.hosted.exosite.io/api:1/business/XYZxyz/solution/'
|
257
|
+
).with(body: { label: 'ONe-8796-gkl', type: 'product' })
|
258
|
+
.to_return(body: '{"id": "abc123def456ghi78", "name": "ONe-8796-gkl"}')
|
252
259
|
|
253
260
|
# 2017-05-26: Dashes forbidden! MUR-1994
|
254
|
-
#expect { @biz.new_solution!(
|
255
|
-
expect { @biz.new_solution!(
|
256
|
-
MrMurano::Product.new.name_validate_help
|
261
|
+
#expect { @biz.new_solution!('ONe-8796-gkl', :product) }.to_not raise_error
|
262
|
+
expect { @biz.new_solution!('ONe-8796-gkl', :product) }.to raise_error(
|
263
|
+
MrMurano::Product.new.name_validate_help
|
264
|
+
)
|
257
265
|
end
|
258
266
|
|
259
|
-
it
|
260
|
-
expect { @biz.new_solution!(
|
261
|
-
MrMurano::Product.new.name_validate_help
|
267
|
+
it 'creates solution; that is too long' do
|
268
|
+
expect { @biz.new_solution!('o' * 70, :product) }.to raise_error(
|
269
|
+
MrMurano::Product.new.name_validate_help
|
270
|
+
)
|
262
271
|
end
|
263
272
|
|
264
|
-
it
|
265
|
-
expect { @biz.new_solution!(
|
266
|
-
MrMurano::Product.new.name_validate_help
|
273
|
+
it 'creates solution; with underscore' do
|
274
|
+
expect { @biz.new_solution!('one_two', :product) }.to raise_error(
|
275
|
+
MrMurano::Product.new.name_validate_help
|
276
|
+
)
|
267
277
|
end
|
268
278
|
|
269
|
-
it
|
270
|
-
expect { @biz.new_solution!(
|
271
|
-
MrMurano::Product.new.name_validate_help
|
279
|
+
it 'creates solution; with digit first' do
|
280
|
+
expect { @biz.new_solution!('1two', :product) }.to raise_error(
|
281
|
+
MrMurano::Product.new.name_validate_help
|
282
|
+
)
|
272
283
|
end
|
273
284
|
|
274
|
-
it
|
285
|
+
it 'creates solution; without biz.id' do
|
275
286
|
allow($cfg).to receive(:get).with('business.id').and_return(nil)
|
276
|
-
expect { @biz.new_solution!(
|
287
|
+
expect { @biz.new_solution!('one', :product) }.to raise_error(MISSING_BIZ_ID_MSG)
|
277
288
|
end
|
278
289
|
|
279
|
-
it
|
280
|
-
stub_request(
|
281
|
-
|
290
|
+
it 'deletes solution' do
|
291
|
+
stub_request(
|
292
|
+
:delete, 'https://bizapi.hosted.exosite.io/api:1/business/XYZxyz/solution/one'
|
293
|
+
).to_return(body: '')
|
282
294
|
|
283
|
-
ret = @biz.delete_solution(
|
295
|
+
ret = @biz.delete_solution('one')
|
284
296
|
expect(ret).to eq({})
|
285
297
|
end
|
286
298
|
|
287
|
-
it
|
299
|
+
it 'deletes solution; without biz.id' do
|
288
300
|
allow($cfg).to receive(:get).with('business.id').and_return(nil)
|
289
|
-
expect { @biz.delete_solution(
|
301
|
+
expect { @biz.delete_solution('one') }.to raise_error(MISSING_BIZ_ID_MSG)
|
290
302
|
end
|
291
303
|
end
|
292
304
|
|
data/spec/ConfigFile_spec.rb
CHANGED
@@ -1,16 +1,23 @@
|
|
1
|
+
# Last Modified: 2017.09.12 /coding: utf-8
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
# Copyright © 2016-2017 Exosite LLC.
|
5
|
+
# License: MIT. See LICENSE.txt.
|
6
|
+
# vim:tw=0:ts=2:sw=2:et:ai
|
7
|
+
|
1
8
|
require 'MrMurano/version'
|
2
9
|
require 'MrMurano/Config'
|
3
10
|
require 'tempfile'
|
4
11
|
|
5
12
|
RSpec.describe MrMurano::Config::ConfigFile do
|
6
|
-
it
|
13
|
+
it 'Creates a file' do
|
7
14
|
tmpfile = Dir.tmpdir + '/cfgtest' # This way because Tempfile.new creates.
|
8
15
|
begin
|
9
16
|
cf = MrMurano::Config::ConfigFile.new(:user, tmpfile)
|
10
17
|
cf.write
|
11
18
|
|
12
19
|
expect(FileTest.exist?(tmpfile))
|
13
|
-
unless Gem.win_platform?
|
20
|
+
unless Gem.win_platform?
|
14
21
|
expect(FileTest.world_readable?(tmpfile)).to be(nil)
|
15
22
|
expect(FileTest.world_writable?(tmpfile)).to be(nil)
|
16
23
|
end
|
@@ -19,7 +26,7 @@ RSpec.describe MrMurano::Config::ConfigFile do
|
|
19
26
|
end
|
20
27
|
end
|
21
28
|
|
22
|
-
it
|
29
|
+
it ':internal does not write a file' do
|
23
30
|
tmpfile = Dir.tmpdir + '/cfgtest' # This way because Tempfile.new creates.
|
24
31
|
begin
|
25
32
|
MrMurano::Config::ConfigFile.new(:internal, tmpfile)
|
@@ -28,7 +35,7 @@ RSpec.describe MrMurano::Config::ConfigFile do
|
|
28
35
|
File.unlink(tmpfile) if FileTest.exist?(tmpfile)
|
29
36
|
end
|
30
37
|
end
|
31
|
-
it
|
38
|
+
it ':defaults does not write a file' do
|
32
39
|
tmpfile = Dir.tmpdir + '/cfgtest' # This way because Tempfile.new creates.
|
33
40
|
begin
|
34
41
|
MrMurano::Config::ConfigFile.new(:defaults, tmpfile)
|
@@ -38,14 +45,11 @@ RSpec.describe MrMurano::Config::ConfigFile do
|
|
38
45
|
end
|
39
46
|
end
|
40
47
|
|
41
|
-
it
|
42
|
-
|
43
|
-
|
48
|
+
it 'loads a file' do
|
49
|
+
cf = MrMurano::Config::ConfigFile.new(:project, 'spec/fixtures/configfile')
|
50
|
+
cf.load
|
44
51
|
|
45
|
-
|
52
|
+
expect(cf[:data]['solution']['id']).to eq('XXXXXXXXXX')
|
46
53
|
end
|
47
|
-
|
48
54
|
end
|
49
55
|
|
50
|
-
# vim: set ai et sw=2 ts=2 :
|
51
|
-
|