MuranoCLI 3.0.2 → 3.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +30 -59
  3. data/Gemfile +9 -3
  4. data/MuranoCLI.gemspec +11 -4
  5. data/bin/murano +2 -90
  6. data/lib/MrMurano.rb +5 -1
  7. data/lib/MrMurano/{spec_commander.rb → Commander-Entry.rb} +1 -2
  8. data/lib/MrMurano/Solution.rb +12 -15
  9. data/lib/MrMurano/SolutionId.rb +1 -5
  10. data/lib/MrMurano/SyncAllowed.rb +2 -2
  11. data/lib/MrMurano/SyncUpDown.rb +6 -3
  12. data/lib/MrMurano/progress.rb +11 -2
  13. data/lib/MrMurano/verbosing.rb +3 -2
  14. data/lib/MrMurano/version.rb +2 -2
  15. data/spec/Account-Passwords_spec.rb +34 -48
  16. data/spec/Account_spec.rb +58 -63
  17. data/spec/Business_spec.rb +151 -139
  18. data/spec/ConfigFile_spec.rb +15 -11
  19. data/spec/ConfigMigrate_spec.rb +23 -12
  20. data/spec/Config_spec.rb +57 -54
  21. data/spec/Content_spec.rb +233 -201
  22. data/spec/GatewayBase_spec.rb +35 -27
  23. data/spec/GatewayDevice_spec.rb +149 -149
  24. data/spec/GatewayResource_spec.rb +115 -102
  25. data/spec/GatewaySettings_spec.rb +69 -62
  26. data/spec/Http_spec.rb +66 -56
  27. data/spec/MakePretties_spec.rb +82 -73
  28. data/spec/Mock_spec.rb +38 -29
  29. data/spec/ProjectFile_spec.rb +118 -106
  30. data/spec/Setting_spec.rb +24 -15
  31. data/spec/Solution-ServiceConfig_spec.rb +168 -140
  32. data/spec/Solution-ServiceEventHandler_spec.rb +186 -188
  33. data/spec/Solution-ServiceModules_spec.rb +314 -232
  34. data/spec/Solution-UsersRoles_spec.rb +136 -86
  35. data/spec/Solution_spec.rb +78 -50
  36. data/spec/SyncRoot_spec.rb +26 -24
  37. data/spec/SyncUpDown_spec.rb +268 -249
  38. data/spec/Verbosing_spec.rb +95 -93
  39. data/spec/Webservice-Cors_spec.rb +141 -95
  40. data/spec/Webservice-Endpoint_spec.rb +382 -346
  41. data/spec/Webservice-File_spec.rb +148 -109
  42. data/spec/Webservice-Setting_spec.rb +47 -41
  43. data/spec/cmd_business_spec.rb +17 -17
  44. data/spec/cmd_common.rb +27 -7
  45. data/spec/cmd_config_spec.rb +31 -20
  46. data/spec/cmd_content_spec.rb +80 -68
  47. data/spec/cmd_cors_spec.rb +11 -5
  48. data/spec/cmd_device_spec.rb +16 -14
  49. data/spec/cmd_domain_spec.rb +10 -8
  50. data/spec/cmd_exchange_spec.rb +3 -3
  51. data/spec/cmd_init_spec.rb +100 -101
  52. data/spec/cmd_keystore_spec.rb +17 -12
  53. data/spec/cmd_link_spec.rb +22 -37
  54. data/spec/cmd_password_spec.rb +11 -7
  55. data/spec/cmd_setting_application_spec.rb +47 -33
  56. data/spec/cmd_setting_product_spec.rb +32 -27
  57. data/spec/cmd_status_spec.rb +125 -114
  58. data/spec/cmd_syncdown_spec.rb +70 -65
  59. data/spec/cmd_syncup_spec.rb +19 -15
  60. data/spec/cmd_usage_spec.rb +14 -10
  61. metadata +29 -15
@@ -1,4 +1,5 @@
1
- # Last Modified: 2017.09.11 /coding: utf-8
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 "WORKSPACE"
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("TTTTTTTTTT")
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 "lists products" do
34
+ it 'lists products' do
34
35
  prodlist = [
35
- {bizid: "XYZxyz",
36
- type: "product",
37
- pid: "ABC",
38
- modelId: "cde",
39
- label: "fts",
40
- api_id: "XYZ",
41
- sid: "XYZ",
42
- name: "XYZ",},
43
- {bizid: "XYZxyz",
44
- type: "product",
45
- pid: "fgh",
46
- modelId: "ijk",
47
- label: "lua-test",
48
- api_id: "XYZ",
49
- sid: "XYZ",
50
- name: "XYZ",},
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(:get, "https://bizapi.hosted.exosite.io/api:1/business/XYZxyz/solution/").
53
- to_return(body: prodlist)
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 "lists products; without biz.id" do
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("Getting all solutions of type product")
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 "creates product" do
70
- # LATER: Re-enable using "ONe" instead of "one" after upcase fixed in pegasus_registry.
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, "https://bizapi.hosted.exosite.io/api:1/business/XYZxyz/solution/"
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("one")
79
+ prod = @biz.new_product('one')
78
80
  expect(prod.valid?).to be true
79
81
  end
80
82
 
81
- it "creates product; without biz.id" do
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 "ONe" instead of "one" after upcase fixed in pegasus_registry.
84
- expect { @biz.new_product("one") }.to raise_error(MISSING_BIZ_ID_MSG)
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 "deletes product" do
88
- # LATER: Re-enable using "ONe" instead of "one" after upcase fixed in pegasus_registry.
89
- stub_request(:delete, "https://bizapi.hosted.exosite.io/api:1/business/XYZxyz/solution/one").
90
- to_return(body: "")
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("one")
95
+ ret = @biz.delete_product('one')
93
96
  expect(ret).to eq({})
94
97
  end
95
98
 
96
- it "deletes product; without biz.id" do
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 "ONe" instead of "one" after upcase fixed in pegasus_registry.
99
- expect { @biz.delete_product("one") }.to raise_error(MISSING_BIZ_ID_MSG)
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 "lists applications" do
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: "XYZxyz",
109
- type: "application",
110
- domain: "XYZxyz.apps.exosite.io",
111
- api_id: "ACBabc",
112
- sid: "ACBabc",
113
- name: "ijk",
114
- },
115
- {bizid: "XYZxyz",
116
- type: "application",
117
- domain: "XYZxyz.apps.exosite.io",
118
- api_id: "DEFdef",
119
- sid: "DEFdef",
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: "XYZxyz",
125
- type: "product",
126
- pid: "ABC",
127
- modelId: "cde",
128
- label: "fts",
129
- name: "fgh",
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(:get, "https://bizapi.hosted.exosite.io/api:1/business/XYZxyz/solution/").
134
- to_return(body: solnlist)
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 "lists applications; without biz.id" do
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("Getting all solutions of type application")
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 "creates application" do
152
- # LATER: Re-enable using "ONe" instead of "one" after upcase fixed in pegasus_registry.
153
- stub_request(:post, "https://bizapi.hosted.exosite.io/api:1/business/XYZxyz/solution/").
154
- with(:body => {:label=>'one', :type=>'application'}).
155
- to_return(body: '{"id": "abc123def456ghi78", "name": "one"}')
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("one")
160
+ appl = @biz.new_application('one')
158
161
  expect(appl.valid?).to be true
159
162
  end
160
163
 
161
- it "creates application; without biz.id" do
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 "ONe" instead of "one" after upcase fixed in pegasus_registry.
164
- expect { @biz.new_application("one") }.to raise_error(MISSING_BIZ_ID_MSG)
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 "deletes application" do
168
- stub_request(:delete, "https://bizapi.hosted.exosite.io/api:1/business/XYZxyz/solution/ONe").
169
- to_return(body: "")
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("ONe")
175
+ ret = @biz.delete_application('ONe')
172
176
  expect(ret).to eq({})
173
177
  end
174
178
 
175
- it "deletes application; without biz.id" do
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("ONe") }.to raise_error(MISSING_BIZ_ID_MSG)
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 "lists solutions" do
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: "XYZxyz",
186
- type: "product",
187
- domain: "ABCabc.m2.exosite.io",
188
- api_id: "ABCabc",
189
- sid: "ABCabc",
190
- name: "XXX",
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: "XYZxyz",
195
- type: "application",
196
- domain: "XYZxyz.apps.exosite.io",
197
- api_id: "DEFdef",
198
- sid: "DEFdef",
199
- name: "XXX",
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(:get, "https://bizapi.hosted.exosite.io/api:1/business/XYZxyz/solution/").
204
- to_return(body: solnlist)
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 "lists solutions; without biz.id" do
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("Getting all solutions of type all")
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 "creates solution" do
221
- stub_request(:post, "https://bizapi.hosted.exosite.io/api:1/business/XYZxyz/solution/").
222
- with(body: {label: 'one', type: 'product',}).
223
- to_return(body: '{"id": "abc123def456ghi78", "name": "one"}')
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!("one", :product)
229
+ sol = @biz.new_solution!('one', :product)
226
230
  expect(sol.valid?).to be true
227
- expect(sol.api_id).to eq("abc123def456ghi78")
231
+ expect(sol.api_id).to eq('abc123def456ghi78')
228
232
  end
229
233
 
230
- # if false
231
- if true
234
+ still_broken = true
235
+ if still_broken
232
236
  # LATER: Re-enable after upcase fixed in pegasus_registry.
233
- it "creates solution; with upper case" do
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(:post, "https://bizapi.hosted.exosite.io/api:1/business/XYZxyz/solution/").
236
- with(:body => {:label=>'ONe', :type=>'product'}).
237
- to_return(body: '{"id": "abc123def456ghi78", "name": "ONe"}')
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!("ONe", :product) }.to_not raise_error
244
+ expect { @biz.new_solution!('ONe', :product) }.to_not raise_error
240
245
  end
241
246
  else
242
- it "creates solution; with uppercase" do
243
- expect { @biz.new_solution!("oNeTWO", :product) }.to raise_error(
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 "creates solution; with numbers and dashes" do
249
- stub_request(:post, "https://bizapi.hosted.exosite.io/api:1/business/XYZxyz/solution/").
250
- with(:body => {:label=>'ONe-8796-gkl', :type=>'product'}).
251
- to_return(body: '{"id": "abc123def456ghi78", "name": "ONe-8796-gkl"}')
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!("ONe-8796-gkl", :product) }.to_not raise_error
255
- expect { @biz.new_solution!("ONe-8796-gkl", :product) }.to raise_error(
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 "creates solution; that is too long" do
260
- expect { @biz.new_solution!("o"*70, :product) }.to raise_error(
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 "creates solution; with underscore" do
265
- expect { @biz.new_solution!("one_two", :product) }.to raise_error(
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 "creates solution; with digit first" do
270
- expect { @biz.new_solution!("1two", :product) }.to raise_error(
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 "creates solution; without biz.id" do
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!("one", :product) }.to raise_error(MISSING_BIZ_ID_MSG)
287
+ expect { @biz.new_solution!('one', :product) }.to raise_error(MISSING_BIZ_ID_MSG)
277
288
  end
278
289
 
279
- it "deletes solution" do
280
- stub_request(:delete, "https://bizapi.hosted.exosite.io/api:1/business/XYZxyz/solution/one").
281
- to_return(body: "")
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("one")
295
+ ret = @biz.delete_solution('one')
284
296
  expect(ret).to eq({})
285
297
  end
286
298
 
287
- it "deletes solution; without biz.id" do
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("one") }.to raise_error(MISSING_BIZ_ID_MSG)
301
+ expect { @biz.delete_solution('one') }.to raise_error(MISSING_BIZ_ID_MSG)
290
302
  end
291
303
  end
292
304
 
@@ -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 "Creates a file" do
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? then
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 ":internal does not write a file" do
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 ":defaults does not write a file" do
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 "loads a file" do
42
- cf = MrMurano::Config::ConfigFile.new(:project, 'spec/fixtures/configfile')
43
- cf.load
48
+ it 'loads a file' do
49
+ cf = MrMurano::Config::ConfigFile.new(:project, 'spec/fixtures/configfile')
50
+ cf.load
44
51
 
45
- expect(cf[:data]['solution']['id']).to eq('XXXXXXXXXX')
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
-