configatron 2.13.0 → 3.0.0.rc1

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.
Files changed (46) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +0 -0
  3. data/.rvmrc +0 -1
  4. data/.travis.yml +5 -2
  5. data/Gemfile +5 -1
  6. data/Gemfile.lock +30 -13
  7. data/Guardfile +24 -0
  8. data/LICENSE.txt +22 -0
  9. data/README.md +122 -112
  10. data/Rakefile +6 -4
  11. data/V2-README.md +243 -0
  12. data/configatron.gemspec +4 -31
  13. data/lib/configatron/core.rb +3 -94
  14. data/lib/configatron/deep_clone.rb +69 -0
  15. data/lib/configatron/errors.rb +5 -9
  16. data/lib/configatron/rails.rb +8 -8
  17. data/lib/configatron/store.rb +66 -339
  18. data/lib/configatron/version.rb +1 -1
  19. data/lib/configatron.rb +8 -16
  20. data/lib/generators/configatron/install/install_generator.rb +0 -0
  21. data/lib/generators/configatron/install/templates/configatron/defaults.rb +0 -0
  22. data/lib/generators/configatron/install/templates/configatron/development.rb +0 -0
  23. data/lib/generators/configatron/install/templates/configatron/production.rb +0 -0
  24. data/lib/generators/configatron/install/templates/configatron/test.rb +0 -0
  25. data/lib/generators/configatron/install/templates/initializers/configatron.rb +0 -0
  26. data/test/configatron/store_test.rb +191 -0
  27. data/test/configatron_test.rb +5 -0
  28. data/test/test_helper.rb +14 -0
  29. metadata +27 -54
  30. data/LICENSE +0 -21
  31. data/lib/configatron/core_ext/class.rb +0 -25
  32. data/lib/configatron/core_ext/kernel.rb +0 -8
  33. data/lib/configatron/core_ext/object.rb +0 -13
  34. data/lib/configatron/core_ext/string.rb +0 -90
  35. data/lib/configatron/proc.rb +0 -104
  36. data/spec/configatron/proc_spec.rb +0 -67
  37. data/spec/configatron/rails_spec.rb +0 -66
  38. data/spec/lib/class_spec.rb +0 -46
  39. data/spec/lib/complex.yml +0 -13
  40. data/spec/lib/configatron_spec.rb +0 -630
  41. data/spec/lib/futurama.yml +0 -6
  42. data/spec/lib/lost.yml +0 -14
  43. data/spec/lib/math.yml +0 -2
  44. data/spec/lib/merge.yml +0 -14
  45. data/spec/spec_helper.rb +0 -4
  46. data/spec/support/rails.rb +0 -7
@@ -1,630 +0,0 @@
1
- require File.join(File.dirname(__FILE__), '..', 'spec_helper')
2
-
3
- describe "configatron" do
4
-
5
- before(:each) do
6
- configatron.reset!
7
- end
8
-
9
- describe '.strict' do
10
- it 'should raise an error for undefined keys' do
11
- Configatron.strict = true
12
- lambda {configatron.undefined}.should raise_error(IndexError)
13
- lambda {configatron.undefined?}.should raise_error(IndexError)
14
- end
15
-
16
- it 'should not raise an error for existing keys' do
17
- configatron.defined
18
- configatron.defined?
19
- Configatron.strict = true
20
- configatron.defined
21
- configatron.defined?
22
- end
23
- end
24
-
25
- it 'should respond to test without blowing up' do
26
- configatron.test.should be_nil
27
- configatron.test = 'hi!'
28
- configatron.test.should == 'hi!'
29
- configatron.foo.test.should be_nil
30
- configatron.foo.test = 'hi!'
31
- configatron.foo.test.should == 'hi!'
32
- end
33
-
34
- describe "respond_to" do
35
-
36
- it 'should respond_to respond_to?' do
37
- configatron.test.should be_nil
38
- configatron.test = 'hi!'
39
- configatron.respond_to?(:test).should be_true
40
- configatron.respond_to?(:plop).should be_false
41
- end
42
-
43
- it 'should respond_to respond_to? recursively' do
44
- configatron.foo.test.should be_nil
45
- configatron.foo.test = 'hi!l'
46
- configatron.foo.respond_to?(:test).should be_true
47
- configatron.foo.respond_to?(:plop).should be_false
48
- end
49
-
50
- end
51
-
52
- describe 'block assignment' do
53
-
54
- it 'should pass the store to the block' do
55
- configatron.test do |c|
56
- c.should === configatron.test
57
- end
58
- end
59
-
60
- it 'should persist changes outside of the block' do
61
- configatron.test.one = 1
62
- configatron.test.two = 2
63
- configatron.test do |c|
64
- c.two = 'two'
65
- end
66
- configatron.test.one.should === 1
67
- configatron.test.two.should === 'two'
68
- end
69
-
70
- it 'should pass the default store to a temp block' do
71
- configatron.temp do |c|
72
- c.class.should == Configatron::Store
73
- end
74
- end
75
-
76
- end
77
-
78
- describe 'exists?' do
79
-
80
- it 'should return true or false depending on whether or the setting exists' do
81
- configatron.temp do
82
- configatron.i.am.alive = 'alive!'
83
- configatron.i.am.should be_exists(:alive)
84
- configatron.i.am.should be_exists('alive')
85
- end
86
- configatron.i.am.should_not be_exists(:alive)
87
- configatron.i.am.should_not be_exists('alive')
88
- end
89
-
90
- end
91
-
92
- describe 'configatron_keys' do
93
-
94
- it 'should return a list of keys in the store' do
95
- configatron.abcd.a = 'A'
96
- configatron.abcd.b = 'B'
97
- configatron.abcd.c = 'C'
98
- configatron.abcd.configatron_keys.should == ['a', 'b', 'c']
99
- end
100
-
101
- end
102
-
103
- describe 'heirarchy' do
104
-
105
- it 'should return a string representing where in the heirarchy the current Store is' do
106
- configatron.a.b.c.d.heirarchy.should == 'a.b.c.d'
107
- end
108
-
109
- end
110
-
111
- describe 'protect' do
112
-
113
- it 'should protect a parameter and prevent it from being set' do
114
- configatron.one = 1
115
- configatron.protect(:one)
116
- lambda{configatron.one = 'one'}.should raise_error(Configatron::ProtectedParameter)
117
- configatron.one.should == 1
118
- end
119
-
120
- it 'should protect basic methods' do
121
- lambda{configatron.object_id = 123456}.should raise_error(Configatron::ProtectedParameter)
122
- lambda{configatron.foo.object_id = 123456}.should raise_error(Configatron::ProtectedParameter)
123
- end
124
-
125
- it 'should work with nested parameters' do
126
- configatron.one = 1
127
- configatron.letters.a = 'A'
128
- configatron.letters.b = 'B'
129
- configatron.letters.protect(:a)
130
- lambda{configatron.letters.a = 'a'}.should raise_error(Configatron::ProtectedParameter)
131
- configatron.letters.a.should == 'A'
132
- configatron.protect(:letters)
133
- lambda{configatron.letters.a = 'a'}.should raise_error(Configatron::ProtectedParameter)
134
- lambda{configatron.letters = 'letter'}.should raise_error(Configatron::ProtectedParameter)
135
- end
136
-
137
- it 'should work with configure_from_hash' do
138
- configatron.one = 1
139
- configatron.letters.a = 'A'
140
- configatron.letters.b = 'B'
141
- configatron.letters.protect(:a)
142
- lambda{configatron.configure_from_hash(:letters => {:a => 'a'})}.should raise_error(Configatron::ProtectedParameter)
143
- configatron.letters.a.should == 'A'
144
- configatron.protect(:letters)
145
- lambda{configatron.letters.configure_from_hash(:a => 'a')}.should raise_error(Configatron::ProtectedParameter)
146
- lambda{configatron.configure_from_hash(:letters => 'letters')}.should raise_error(Configatron::ProtectedParameter)
147
- end
148
-
149
- it "should be able to protect all parameters at once" do
150
- configatron.one = 1
151
- configatron.letters.a = 'A'
152
- configatron.letters.b = 'B'
153
- configatron.protect_all!
154
- [:a,:b].each do |l|
155
- lambda{configatron.configure_from_hash(:letters => {l => l.to_s})}.should raise_error(Configatron::ProtectedParameter)
156
- configatron.letters.send(l).should == l.to_s.upcase
157
- end
158
- lambda{configatron.letters.configure_from_hash(:a => 'a')}.should raise_error(Configatron::ProtectedParameter)
159
- lambda{configatron.configure_from_hash(:letters => 'letters')}.should raise_error(Configatron::ProtectedParameter)
160
- end
161
-
162
- it "should be able to unprotect a parameter" do
163
- configatron.one = 1
164
- configatron.protect(:one)
165
- configatron.unprotect(:one)
166
- lambda{configatron.one = 2}.should_not raise_error
167
- end
168
-
169
- it "should be able to unprotect all parameters at once" do
170
- configatron.one = 1
171
- configatron.letters.a = 'A'
172
- configatron.letters.b = 'B'
173
- configatron.protect_all!
174
- configatron.unprotect_all!
175
- lambda{configatron.one = 2}.should_not raise_error
176
- lambda{configatron.letters.configure_from_hash(:a => 'a')}.should_not raise_error
177
- end
178
-
179
- end
180
-
181
- describe 'lock' do
182
-
183
- before :each do
184
- configatron.letters.a = 'A'
185
- configatron.letters.b = 'B'
186
- configatron.letters.greek.alpha = 'alpha'
187
- configatron.lock(:letters)
188
- end
189
-
190
- it 'should allow setting of existing parameters in locked parameter' do
191
- lambda { configatron.letters.a = 'a' }.should_not raise_error
192
- end
193
-
194
- it 'should not allow setting of a parameter that is not already set' do
195
- lambda { configatron.letters.c = 'C' }.should raise_error(Configatron::LockedNamespace)
196
- end
197
-
198
- it 'should allow setting of existing parameters in child of locked parameter' do
199
- lambda { configatron.letters.greek.alpha = 'a' }.should_not raise_error
200
- end
201
-
202
- it 'should not allow setting of new parameters in child of locked parameter' do
203
- lambda { configatron.letters.greek.beta = 'beta' }.should raise_error(Configatron::LockedNamespace)
204
- end
205
-
206
- it 'should not affect parameters below the locked namespace' do
207
- lambda { configatron.one = 1 }.should_not raise_error
208
- end
209
-
210
- it 'should raise an ArgumentError if unknown namespace is locked' do
211
- lambda { configatron.lock(:numbers).should raise_error(ArgumentError) }
212
- end
213
-
214
- describe 'then unlock' do
215
-
216
- before :each do
217
- configatron.unlock(:letters)
218
- end
219
-
220
- it 'should allow setting of new parameter in unlocked namespace' do
221
- lambda { configatron.letters.d = 'd' }.should_not raise_error
222
- end
223
-
224
- it 'should allow setting of new parameter in unlocked namespace\'s child' do
225
- lambda { configatron.letters.greek.zeta = 'z' }.should_not raise_error
226
- end
227
-
228
- it 'should raise an ArgumentError if unknown namespace is unlocked' do
229
- lambda { configatron.unlock(:numbers).should raise_error(ArgumentError) }
230
- end
231
-
232
- end
233
-
234
- end
235
-
236
- describe 'temp' do
237
-
238
- it 'should revert back to the original parameters when the block ends' do
239
- configatron.one = 1
240
- configatron.letters.a = 'A'
241
- configatron.letters.b = 'B'
242
- configatron.temp do
243
- configatron.letters.b = 'bb'
244
- configatron.letters.c = 'c'
245
- configatron.one.should == 1
246
- configatron.letters.a.should == 'A'
247
- configatron.letters.b.should == 'bb'
248
- configatron.letters.c.should == 'c'
249
- end
250
- configatron.one.should == 1
251
- configatron.letters.a.should == 'A'
252
- configatron.letters.b.should == 'B'
253
- configatron.letters.c.should be_nil
254
- end
255
-
256
- it 'should take an optional hash of parameters' do
257
- configatron.one = 1
258
- configatron.letters.a = 'A'
259
- configatron.letters.b = 'B'
260
- configatron.temp(:letters => {:b => 'bb', :c => 'c'}) do
261
- configatron.one.should == 1
262
- configatron.letters.a.should == 'A'
263
- configatron.letters.b.should == 'bb'
264
- configatron.letters.c.should == 'c'
265
- end
266
- configatron.one.should == 1
267
- configatron.letters.a.should == 'A'
268
- configatron.letters.b.should == 'B'
269
- configatron.letters.c.should be_nil
270
- end
271
-
272
- it 'should work the same as temp_start/temp_end' do
273
- configatron.one = 1
274
- configatron.temp_start
275
- configatron.one = 'ONE'
276
- configatron.one.should == 'ONE'
277
- configatron.temp_end
278
- configatron.one.should == 1
279
- end
280
-
281
- it 'should be able to nest' do
282
- configatron.one = 1
283
- configatron.letters.a = 'A'
284
- configatron.letters.b = 'B'
285
- configatron.temp do
286
- configatron.letters.b = 'bb'
287
- configatron.letters.c = 'c'
288
- configatron.one.should == 1
289
- configatron.letters.a.should == 'A'
290
- configatron.letters.b.should == 'bb'
291
- configatron.letters.c.should == 'c'
292
- configatron.temp do
293
- configatron.letters.b = 'bbb'
294
- configatron.one.should == 1
295
- configatron.letters.a.should == 'A'
296
- configatron.letters.b.should == 'bbb'
297
- configatron.letters.c.should == 'c'
298
- end
299
- end
300
- configatron.one.should == 1
301
- configatron.letters.a.should == 'A'
302
- configatron.letters.b.should == 'B'
303
- configatron.letters.c.should be_nil
304
- end
305
-
306
- end
307
-
308
- describe 'configure_from_hash' do
309
-
310
- it 'should configure itself from a hash' do
311
- configatron.foo.should be_nil
312
- configatron.configure_from_hash(:foo => :bar)
313
- configatron.foo.should == :bar
314
- end
315
-
316
- it 'should handled deeply nested params' do
317
- configatron.friends.rachel.should be_nil
318
- configatron.configure_from_hash(:friends => {:rachel => 'Rachel Green'})
319
- configatron.friends.rachel.should == 'Rachel Green'
320
- end
321
-
322
- it 'should not remove previously defined params' do
323
- configatron.friends.rachel = 'Rachel Green'
324
- configatron.friends.ross = 'Ross Gellar'
325
- configatron.friends.monica = 'Monica Gellar'
326
- configatron.configure_from_hash(:friends => {:rachel => 'R. Green', :monica => 'Monica Bing'})
327
- configatron.friends.ross.should == 'Ross Gellar'
328
- configatron.friends.rachel.should == 'R. Green'
329
- configatron.friends.monica.should == 'Monica Bing'
330
- end
331
-
332
- end
333
-
334
- describe 'configure_from_yaml' do
335
-
336
- it 'should configure itself from a yaml file' do
337
- configatron.futurama.should be_nil
338
- configatron.configure_from_yaml(File.join(File.dirname(__FILE__), 'futurama.yml'))
339
- configatron.futurama.robots.bender.should == 'Bender The Robot'
340
- end
341
-
342
- it 'should not remove previously defined params' do
343
- configatron.futurama.mutants.leela = 'Leela'
344
- configatron.configure_from_yaml(File.join(File.dirname(__FILE__), 'futurama.yml'))
345
- configatron.futurama.robots.bender.should == 'Bender The Robot'
346
- configatron.futurama.mutants.leela = 'Leela'
347
- end
348
-
349
- it "should fail silently if the file doesn't exist" do
350
- lambda{configatron.configure_from_yaml('i_dont_exist.yml')}.should_not raise_error
351
- end
352
-
353
- it "should be able to load a specific hash from the file" do
354
- configatron.others.should be_nil
355
- configatron.survivors.should be_nil
356
- configatron.configure_from_yaml(File.join(File.dirname(__FILE__), 'lost.yml'), :hash => "survivors")
357
- configatron.others.should be_nil
358
- configatron.survivors.should be_nil
359
- configatron.on_island.jack.should == 'Jack Shepherd'
360
- end
361
-
362
- it 'should run the yaml through ERB' do
363
- configatron.math.should be_nil
364
- configatron.configure_from_yaml(File.join(File.dirname(__FILE__), 'math.yml'))
365
- configatron.math.should_not be_nil
366
- configatron.math.four.should == 4
367
- end
368
-
369
- it 'should handle merged keys' do
370
- unless RUBY_VERSION.match(/^2\.0/)
371
- configatron.food.should be_nil
372
- configatron.configure_from_yaml(File.join(File.dirname(__FILE__), 'merge.yml'))
373
- configatron.food.should_not be_nil
374
- configatron.food.list.should == [:apple, :banana, :tomato, :brocolli, :spinach]
375
- end
376
- end
377
-
378
- it "should handle complex yaml" do
379
- configatron.complex_development.bucket.should be_nil
380
- configatron.configure_from_yaml(File.join(File.dirname(__FILE__), 'complex.yml'))
381
- configatron.complex_development.bucket.should == 'develop'
382
- configatron.complex_development.access_key_id.should == 'access_key'
383
- end
384
-
385
- end
386
-
387
- it 'should return a parameter' do
388
- configatron.foo = :bar
389
- configatron.foo.should == :bar
390
- end
391
-
392
- it 'should return a nested parameter' do
393
- configatron.children.dylan = 'Dylan Bates'
394
- configatron.children.dylan.should == 'Dylan Bates'
395
- end
396
-
397
- it 'should set a nested parameter and not remove previously defined params' do
398
- configatron.friends.rachel = 'Rachel Green'
399
- configatron.friends.rachel.should == 'Rachel Green'
400
- configatron.friends.ross = 'Ross Gellar'
401
- configatron.friends.ross.should == 'Ross Gellar'
402
- configatron.friends.monica = 'Monica Gellar'
403
- configatron.friends.monica.should == 'Monica Gellar'
404
- configatron.friends.rachel = 'R. Green'
405
- configatron.friends.monica = 'Monica Bing'
406
- configatron.friends.rachel.should == 'R. Green'
407
- configatron.friends.ross.should == 'Ross Gellar'
408
- configatron.friends.monica.should == 'Monica Bing'
409
- end
410
-
411
- it 'should return the Configatron instance' do
412
- configatron.should be_is_a(Configatron)
413
- end
414
-
415
- describe 'to_hash' do
416
-
417
- it 'should return a hash of all the params' do
418
- configatron.one = 1
419
- configatron.letters.a = 'A'
420
- configatron.letters.b = 'B'
421
-
422
- h = configatron.to_hash
423
- h.should be_an_instance_of(Hash)
424
- h[:letters].should be_an_instance_of(Hash)
425
-
426
- h[:one].should == 1
427
- h[:letters][:b].should == 'B'
428
- end
429
-
430
- end
431
-
432
- describe 'inspect' do
433
-
434
- it 'should call return the inspect method of the to_hash method' do
435
- configatron.one = 1
436
- configatron.letters.a = 'A'
437
- configatron.letters.b = 'B'
438
- configatron.numbers.small.one = 1
439
- configatron.numbers.small.others = [2,3]
440
- configatron.numbers.big.one.hundred = '100'
441
-
442
- configatron.inspect.should == %{
443
- configatron.letters.a = "A"
444
- configatron.letters.b = "B"
445
- configatron.numbers.big.one.hundred = "100"
446
- configatron.numbers.small.one = 1
447
- configatron.numbers.small.others = [2, 3]
448
- configatron.one = 1
449
- }.strip
450
-
451
- end
452
-
453
- end
454
-
455
- describe 'nil?' do
456
-
457
- it 'should return true if there are no parameters' do
458
- configatron.should be_nil
459
- configatron.friends.should be_nil
460
- end
461
-
462
- it 'should return true if there are no parameters on a nested parameter' do
463
- configatron.friends.monica.should be_nil
464
- end
465
-
466
- end
467
-
468
- describe 'retrieve' do
469
-
470
- it 'should retrieve a parameter' do
471
- configatron.office = 'Michael'
472
- configatron.retrieve(:office).should == 'Michael'
473
- end
474
-
475
- it 'should return the optional second parameter if the config setting is nil' do
476
- configatron.retrieve(:office, 'Stanley').should == 'Stanley'
477
- end
478
-
479
- it 'should work with a symbol or a string' do
480
- configatron.office = 'Michael'
481
- configatron.retrieve(:office).should == 'Michael'
482
- configatron.retrieve('office').should == 'Michael'
483
- end
484
-
485
- it 'should work on nested parameters' do
486
- configatron.the.office = 'Michael'
487
- configatron.the.retrieve(:office).should == 'Michael'
488
- configatron.the.retrieve('office').should == 'Michael'
489
- end
490
-
491
- end
492
-
493
- describe 'remove' do
494
-
495
- it 'should remove a parameter' do
496
- configatron.movies = 'Pulp Fiction'
497
- configatron.movies.should == 'Pulp Fiction'
498
- configatron.remove(:movies)
499
- configatron.movies.should be_nil
500
- end
501
-
502
- it 'should remove a nested parameter' do
503
- configatron.the.movies = 'Pulp Fiction'
504
- configatron.the.movies.should == 'Pulp Fiction'
505
- configatron.the.remove(:movies)
506
- configatron.the.movies.should be_nil
507
- end
508
-
509
- it 'should work with a symbol or a string' do
510
- configatron.the.movies = 'Pulp Fiction'
511
- configatron.the.office = 'Michael'
512
- configatron.the.remove(:movies)
513
- configatron.the.movies.should be_nil
514
- configatron.the.remove('office')
515
- configatron.the.office.should be_nil
516
- end
517
-
518
- it 'should remove all sub-parameters' do
519
- configatron.the.movies = 'Pulp Fiction'
520
- configatron.the.office = 'Michael'
521
- configatron.remove(:the)
522
- configatron.the.should be_nil
523
- configatron.the.movies.should be_nil
524
- end
525
-
526
- end
527
-
528
- describe 'set_default' do
529
-
530
- it 'should set a default parameter value' do
531
- configatron.set_default(:movies, 'Pulp Fiction')
532
- configatron.movies.should == 'Pulp Fiction'
533
- end
534
-
535
- it 'should set a default parameter value for a nested parameter' do
536
- configatron.the.set_default(:movies, 'Pulp Fiction')
537
- configatron.the.movies.should == 'Pulp Fiction'
538
- end
539
-
540
- it 'should not set the parameter if it is already set' do
541
- configatron.movies = 'Transformers'
542
- configatron.set_default(:movies, 'Pulp Fiction')
543
- configatron.movies.should == 'Transformers'
544
- end
545
-
546
- it 'should not set the nested parameter if it is already set' do
547
- configatron.the.movies = 'Transformers'
548
- configatron.the.set_default(:movies, 'Pulp Fiction')
549
- configatron.the.movies.should == 'Transformers'
550
- end
551
-
552
- end
553
-
554
- describe 'reset!' do
555
-
556
- it 'should clear out all parameter' do
557
- configatron.one = 1
558
- configatron.letters.a = 'A'
559
- configatron.letters.b = 'B'
560
- configatron.one.should == 1
561
- configatron.letters.a.should == 'A'
562
- configatron.reset!
563
- configatron.one.should be_nil
564
- configatron.letters.a.should be_nil
565
- end
566
-
567
- end
568
-
569
- if Object.new.respond_to?(:blank?)
570
- describe :blank? do
571
-
572
- context "uninitialized option" do
573
- specify { configatron.foo.bar.should be_blank }
574
- end
575
-
576
- context "nil option" do
577
- before { configatron.foo.bar = nil }
578
- specify { configatron.foo.bar.should be_blank }
579
- end
580
-
581
- context "false option" do
582
- before { configatron.foo.bar = false }
583
- specify { configatron.foo.bar.should be_blank }
584
- end
585
-
586
- context "empty string option" do
587
- before { configatron.foo.bar = "" }
588
- specify { configatron.foo.bar.should be_blank }
589
- end
590
-
591
- context "empty hash option" do
592
- before { configatron.foo.bar = {} }
593
- specify { configatron.foo.bar.should be_blank }
594
- end
595
-
596
- context "empty array option" do
597
- before { configatron.foo.bar = [] }
598
- specify { configatron.foo.bar.should be_blank }
599
- end
600
-
601
- context "defined option" do
602
- before { configatron.foo.bar = 'asd' }
603
- subject { configatron.foo.bar }
604
- it { should_not be_blank }
605
- it { should == 'asd' }
606
- end
607
-
608
- end
609
- end
610
-
611
- describe "boolean test" do
612
-
613
- context "nil option" do
614
- before { configatron.foo.bar = nil }
615
- specify { configatron.foo.bar?.should be_false }
616
- end
617
-
618
- context "false option" do
619
- before { configatron.foo.bar = false }
620
- specify { configatron.foo.bar?.should be_false }
621
- end
622
-
623
- context "string option" do
624
- before { configatron.foo.bar = 'asd' }
625
- specify { configatron.foo.bar?.should be_true }
626
- end
627
-
628
- end
629
-
630
- end
@@ -1,6 +0,0 @@
1
- futurama:
2
- robots:
3
- bender: Bender The Robot
4
- humans:
5
- fry: Philip J. Fry
6
- amy: Amy Wong
data/spec/lib/lost.yml DELETED
@@ -1,14 +0,0 @@
1
- others:
2
- on_island:
3
- ben: Benjamin Linus
4
- richard: Richard Alpert
5
- deceased:
6
- goodwin: Goodwin Stanhope
7
- mikhail: Mikhail Bakunin
8
- survivors:
9
- on_island:
10
- jack: Jack Shepherd
11
- locke: John Locke
12
- deceased:
13
- charlie: Charlie Pace
14
- michael: Michael Dawson
data/spec/lib/math.yml DELETED
@@ -1,2 +0,0 @@
1
- math:
2
- four: <%= 2 + 2 %>
data/spec/lib/merge.yml DELETED
@@ -1,14 +0,0 @@
1
- ---
2
- void: &void
3
- food:
4
- fruits: &fruits
5
- - :apple
6
- - :banana
7
- - :tomato
8
- vegetables: &vegetables
9
- - :brocolli
10
- - :spinach
11
-
12
- list:
13
- <<: [*fruits, *vegetables, *void]
14
-
data/spec/spec_helper.rb DELETED
@@ -1,4 +0,0 @@
1
- require 'rubygems'
2
- require 'rspec'
3
-
4
- require File.join(File.dirname(__FILE__), '..', 'lib', 'configatron')
@@ -1,7 +0,0 @@
1
- module Rails
2
- class << self
3
- attr_accessor :env
4
- attr_accessor :root
5
- attr_accessor :logger
6
- end
7
- end