aixm 0.3.5 → 0.3.6
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/.gitignore +1 -1
- data/.travis.yml +4 -0
- data/CHANGELOG.md +15 -0
- data/README.md +7 -7
- data/aixm.gemspec +1 -0
- data/{Gemfile → gems.rb} +0 -0
- data/lib/aixm.rb +4 -0
- data/lib/aixm/component/fato.rb +255 -0
- data/lib/aixm/component/helipad.rb +59 -4
- data/lib/aixm/component/layer.rb +2 -2
- data/lib/aixm/component/lighting.rb +133 -0
- data/lib/aixm/component/runway.rb +31 -6
- data/lib/aixm/component/surface.rb +45 -2
- data/lib/aixm/d.rb +3 -3
- data/lib/aixm/document.rb +3 -1
- data/lib/aixm/feature/airport.rb +39 -5
- data/lib/aixm/feature/airspace.rb +7 -1
- data/lib/aixm/feature/unit.rb +3 -1
- data/lib/aixm/p.rb +88 -0
- data/lib/aixm/refinements.rb +15 -15
- data/lib/aixm/shortcuts.rb +4 -0
- data/lib/aixm/version.rb +1 -1
- data/lib/aixm/w.rb +86 -0
- data/lib/aixm/xy.rb +6 -0
- data/{Rakefile → rakefile.rb} +10 -0
- data/spec/factory.rb +64 -6
- data/spec/lib/aixm/component/fato_spec.rb +260 -0
- data/spec/lib/aixm/component/helipad_spec.rb +68 -3
- data/spec/lib/aixm/component/lighting_spec.rb +88 -0
- data/spec/lib/aixm/component/runway_spec.rb +63 -3
- data/spec/lib/aixm/component/surface_spec.rb +36 -0
- data/spec/lib/aixm/d_spec.rb +2 -2
- data/spec/lib/aixm/document_spec.rb +280 -2
- data/spec/lib/aixm/feature/airport_spec.rb +161 -8
- data/spec/lib/aixm/p_spec.rb +189 -0
- data/spec/lib/aixm/refinements_spec.rb +16 -16
- data/spec/lib/aixm/w_spec.rb +150 -0
- data/spec/lib/aixm/xy_spec.rb +11 -0
- data/spec/macros/marking.rb +12 -0
- metadata +32 -4
@@ -28,7 +28,11 @@ describe AIXM::Feature::Airport do
|
|
28
28
|
|
29
29
|
describe :id= do
|
30
30
|
it "fails on invalid values" do
|
31
|
-
[nil, 'A', '
|
31
|
+
[nil, 'A', 'ABCDE', 'AB 1234'].wont_be_written_to subject, :id
|
32
|
+
end
|
33
|
+
|
34
|
+
it "combines 2 character region with an 8 characters digest from name" do
|
35
|
+
subject.tap { |s| s.id = 'lf' }.id.must_equal 'LFD18754F5'
|
32
36
|
end
|
33
37
|
|
34
38
|
it "upcases valid values" do
|
@@ -124,6 +128,20 @@ describe AIXM::Feature::Airport do
|
|
124
128
|
macro :timetable
|
125
129
|
end
|
126
130
|
|
131
|
+
describe :operator= do
|
132
|
+
it "fails on invalid values" do
|
133
|
+
[123].wont_be_written_to subject, :operator
|
134
|
+
end
|
135
|
+
|
136
|
+
it "accepts nil value" do
|
137
|
+
[nil].must_be_written_to subject, :operator
|
138
|
+
end
|
139
|
+
|
140
|
+
it "upcases and transcodes valid values" do
|
141
|
+
subject.tap { |s| s.operator = 'Municipality of Nîmes-Alès' }.operator.must_equal 'MUNICIPALITY OF NIMES-ALES'
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
127
145
|
describe :remarks= do
|
128
146
|
macro :remarks
|
129
147
|
end
|
@@ -159,7 +177,7 @@ describe AIXM::Feature::Airport do
|
|
159
177
|
|
160
178
|
it "adds helipad to the array" do
|
161
179
|
count = subject.helipads.count
|
162
|
-
subject.add_helipad(AIXM.helipad(name: 'H2'))
|
180
|
+
subject.add_helipad(AIXM.helipad(name: 'H2', xy: AIXM::Factory.xy))
|
163
181
|
subject.helipads.count.must_equal count + 1
|
164
182
|
end
|
165
183
|
end
|
@@ -215,6 +233,7 @@ describe AIXM::Feature::Airport do
|
|
215
233
|
<valElev>146</valElev>
|
216
234
|
<uomDistVer>FT</uomDistVer>
|
217
235
|
<valMagVar>1.08</valMagVar>
|
236
|
+
<txtNameAdmin>MUNICIPALITY OF PUJAUT</txtNameAdmin>
|
218
237
|
<valTransitionAlt>10000</valTransitionAlt>
|
219
238
|
<uomTransitionAlt>FT</uomTransitionAlt>
|
220
239
|
<txtRmk>Restricted access</txtRmk>
|
@@ -238,6 +257,12 @@ describe AIXM::Feature::Airport do
|
|
238
257
|
<codePcnMaxTirePressure>W</codePcnMaxTirePressure>
|
239
258
|
<codePcnEvalMethod>T</codePcnEvalMethod>
|
240
259
|
<txtPcnNote>Paved shoulder on 2.5m on each side of the RWY.</txtPcnNote>
|
260
|
+
<valSiwlWeight>1500</valSiwlWeight>
|
261
|
+
<uomSiwlWeight>KG</uomSiwlWeight>
|
262
|
+
<valSiwlTirePressure>0.5</valSiwlTirePressure>
|
263
|
+
<uomSiwlTirePressure>MPA</uomSiwlTirePressure>
|
264
|
+
<valAuwWeight>30</valAuwWeight>
|
265
|
+
<uomAuwWeight>T</uomAuwWeight>
|
241
266
|
<codeSts>CLSD</codeSts>
|
242
267
|
<txtRmk>Markings eroded</txtRmk>
|
243
268
|
</Rwy>
|
@@ -278,6 +303,24 @@ describe AIXM::Feature::Airport do
|
|
278
303
|
<uomDist>M</uomDist>
|
279
304
|
<txtRmk>forth remarks</txtRmk>
|
280
305
|
</Rdd>
|
306
|
+
<Rls>
|
307
|
+
<RlsUid>
|
308
|
+
<RdnUid>
|
309
|
+
<RwyUid>
|
310
|
+
<AhpUid>
|
311
|
+
<codeId>LFNT</codeId>
|
312
|
+
</AhpUid>
|
313
|
+
<txtDesig>16L/34R</txtDesig>
|
314
|
+
</RwyUid>
|
315
|
+
<txtDesig>16L</txtDesig>
|
316
|
+
</RdnUid>
|
317
|
+
<codePsn>AIM</codePsn>
|
318
|
+
</RlsUid>
|
319
|
+
<txtDescr>omnidirectional</txtDescr>
|
320
|
+
<codeIntst>LIM</codeIntst>
|
321
|
+
<codeColour>GRN</codeColour>
|
322
|
+
<txtRmk>lighting remarks</txtRmk>
|
323
|
+
</Rls>
|
281
324
|
<Rdn>
|
282
325
|
<RdnUid>
|
283
326
|
<RwyUid>
|
@@ -315,6 +358,86 @@ describe AIXM::Feature::Airport do
|
|
315
358
|
<uomDist>M</uomDist>
|
316
359
|
<txtRmk>back remarks</txtRmk>
|
317
360
|
</Rdd>
|
361
|
+
<Rls>
|
362
|
+
<RlsUid>
|
363
|
+
<RdnUid>
|
364
|
+
<RwyUid>
|
365
|
+
<AhpUid>
|
366
|
+
<codeId>LFNT</codeId>
|
367
|
+
</AhpUid>
|
368
|
+
<txtDesig>16L/34R</txtDesig>
|
369
|
+
</RwyUid>
|
370
|
+
<txtDesig>34R</txtDesig>
|
371
|
+
</RdnUid>
|
372
|
+
<codePsn>AIM</codePsn>
|
373
|
+
</RlsUid>
|
374
|
+
<txtDescr>omnidirectional</txtDescr>
|
375
|
+
<codeIntst>LIM</codeIntst>
|
376
|
+
<codeColour>GRN</codeColour>
|
377
|
+
<txtRmk>lighting remarks</txtRmk>
|
378
|
+
</Rls>
|
379
|
+
<Fto>
|
380
|
+
<FtoUid>
|
381
|
+
<AhpUid>
|
382
|
+
<codeId>LFNT</codeId>
|
383
|
+
</AhpUid>
|
384
|
+
<txtDesig>H1</txtDesig>
|
385
|
+
</FtoUid>
|
386
|
+
<valLen>35</valLen>
|
387
|
+
<valWid>35</valWid>
|
388
|
+
<uomDim>M</uomDim>
|
389
|
+
<codeComposition>CONC</codeComposition>
|
390
|
+
<codePreparation>PAVED</codePreparation>
|
391
|
+
<codeCondSfc>FAIR</codeCondSfc>
|
392
|
+
<valPcnClass>30</valPcnClass>
|
393
|
+
<codePcnPavementType>F</codePcnPavementType>
|
394
|
+
<codePcnPavementSubgrade>A</codePcnPavementSubgrade>
|
395
|
+
<codePcnMaxTirePressure>W</codePcnMaxTirePressure>
|
396
|
+
<codePcnEvalMethod>U</codePcnEvalMethod>
|
397
|
+
<txtPcnNote>Cracks near the center</txtPcnNote>
|
398
|
+
<valSiwlWeight>1500</valSiwlWeight>
|
399
|
+
<uomSiwlWeight>KG</uomSiwlWeight>
|
400
|
+
<valSiwlTirePressure>0.5</valSiwlTirePressure>
|
401
|
+
<uomSiwlTirePressure>MPA</uomSiwlTirePressure>
|
402
|
+
<valAuwWeight>8</valAuwWeight>
|
403
|
+
<uomAuwWeight>T</uomAuwWeight>
|
404
|
+
<txtProfile>Northwest from RWY 12/30</txtProfile>
|
405
|
+
<txtMarking>Dashed white lines</txtMarking>
|
406
|
+
<codeSts>OTHER</codeSts>
|
407
|
+
<txtRmk>Authorizaton by AD operator required</txtRmk>
|
408
|
+
</Fto>
|
409
|
+
<Fdn>
|
410
|
+
<FdnUid>
|
411
|
+
<FtoUid>
|
412
|
+
<AhpUid>
|
413
|
+
<codeId>LFNT</codeId>
|
414
|
+
</AhpUid>
|
415
|
+
<txtDesig>H1</txtDesig>
|
416
|
+
</FtoUid>
|
417
|
+
<txtDesig>35</txtDesig>
|
418
|
+
</FdnUid>
|
419
|
+
<valTrueBrg>355</valTrueBrg>
|
420
|
+
<valMagBrg>356</valMagBrg>
|
421
|
+
<txtRmk>Avoid flight over residental area</txtRmk>
|
422
|
+
</Fdn>
|
423
|
+
<Fls>
|
424
|
+
<FlsUid>
|
425
|
+
<FdnUid>
|
426
|
+
<FtoUid>
|
427
|
+
<AhpUid>
|
428
|
+
<codeId>LFNT</codeId>
|
429
|
+
</AhpUid>
|
430
|
+
<txtDesig>H1</txtDesig>
|
431
|
+
</FtoUid>
|
432
|
+
<txtDesig>35</txtDesig>
|
433
|
+
</FdnUid>
|
434
|
+
<codePsn>AIM</codePsn>
|
435
|
+
</FlsUid>
|
436
|
+
<txtDescr>omnidirectional</txtDescr>
|
437
|
+
<codeIntst>LIM</codeIntst>
|
438
|
+
<codeColour>GRN</codeColour>
|
439
|
+
<txtRmk>lighting remarks</txtRmk>
|
440
|
+
</Fls>
|
318
441
|
<Tla>
|
319
442
|
<TlaUid>
|
320
443
|
<AhpUid>
|
@@ -322,6 +445,12 @@ describe AIXM::Feature::Airport do
|
|
322
445
|
</AhpUid>
|
323
446
|
<txtDesig>H1</txtDesig>
|
324
447
|
</TlaUid>
|
448
|
+
<FtoUid>
|
449
|
+
<AhpUid>
|
450
|
+
<codeId>LFNT</codeId>
|
451
|
+
</AhpUid>
|
452
|
+
<txtDesig>H1</txtDesig>
|
453
|
+
</FtoUid>
|
325
454
|
<geoLat>43.99915000N</geoLat>
|
326
455
|
<geoLong>004.75154444E</geoLong>
|
327
456
|
<codeDatum>WGE</codeDatum>
|
@@ -338,10 +467,33 @@ describe AIXM::Feature::Airport do
|
|
338
467
|
<codePcnPavementSubgrade>A</codePcnPavementSubgrade>
|
339
468
|
<codePcnMaxTirePressure>W</codePcnMaxTirePressure>
|
340
469
|
<codePcnEvalMethod>U</codePcnEvalMethod>
|
341
|
-
<txtPcnNote>Cracks near the center
|
470
|
+
<txtPcnNote>Cracks near the center</txtPcnNote>
|
471
|
+
<valSiwlWeight>1500</valSiwlWeight>
|
472
|
+
<uomSiwlWeight>KG</uomSiwlWeight>
|
473
|
+
<valSiwlTirePressure>0.5</valSiwlTirePressure>
|
474
|
+
<uomSiwlTirePressure>MPA</uomSiwlTirePressure>
|
475
|
+
<valAuwWeight>8</valAuwWeight>
|
476
|
+
<uomAuwWeight>T</uomAuwWeight>
|
477
|
+
<codeClassHel>1</codeClassHel>
|
478
|
+
<txtMarking>Continuous white lines</txtMarking>
|
342
479
|
<codeSts>OTHER</codeSts>
|
343
480
|
<txtRmk>Authorizaton by AD operator required</txtRmk>
|
344
481
|
</Tla>
|
482
|
+
<Tls>
|
483
|
+
<TlsUid>
|
484
|
+
<TlaUid>
|
485
|
+
<AhpUid>
|
486
|
+
<codeId>LFNT</codeId>
|
487
|
+
</AhpUid>
|
488
|
+
<txtDesig>H1</txtDesig>
|
489
|
+
</TlaUid>
|
490
|
+
<codePsn>AIM</codePsn>
|
491
|
+
</TlsUid>
|
492
|
+
<txtDescr>omnidirectional</txtDescr>
|
493
|
+
<codeIntst>LIM</codeIntst>
|
494
|
+
<codeColour>GRN</codeColour>
|
495
|
+
<txtRmk>lighting remarks</txtRmk>
|
496
|
+
</Tls>
|
345
497
|
<Ahu>
|
346
498
|
<AhuUid>
|
347
499
|
<AhpUid>
|
@@ -408,11 +560,12 @@ describe AIXM::Feature::Airport do
|
|
408
560
|
|
409
561
|
it "builds correct minimal OFMX" do
|
410
562
|
AIXM.ofmx!
|
411
|
-
|
412
|
-
subject.
|
413
|
-
subject.
|
414
|
-
subject.
|
415
|
-
subject.
|
563
|
+
%i(z declination transition_z operator remarks).each { |a| subject.send(:"#{a}=", nil) }
|
564
|
+
subject.instance_eval { @addresses.clear }
|
565
|
+
subject.instance_eval { @runways.clear }
|
566
|
+
subject.instance_eval { @fatos.clear }
|
567
|
+
subject.instance_eval { @helipads.clear }
|
568
|
+
subject.instance_eval { @usage_limitations.clear }
|
416
569
|
subject.to_xml.must_equal <<~END
|
417
570
|
<!-- Airport: LFNT AVIGNON-PUJAUT -->
|
418
571
|
<Ahp source="LF|GEN|0.0 FACTORY|0|0">
|
@@ -0,0 +1,189 @@
|
|
1
|
+
require_relative '../../spec_helper'
|
2
|
+
|
3
|
+
describe AIXM::P do
|
4
|
+
subject do
|
5
|
+
AIXM::Factory.p
|
6
|
+
end
|
7
|
+
|
8
|
+
describe :pres= do
|
9
|
+
it "fails on invalid values" do
|
10
|
+
[:foobar, -1].wont_be_written_to subject, :pres
|
11
|
+
end
|
12
|
+
|
13
|
+
it "converts Numeric to Float" do
|
14
|
+
subject.tap { |s| s.pres = 5 }.pres.must_equal 5.0
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
describe :unit= do
|
19
|
+
it "fails on invalid values" do
|
20
|
+
[:foobar, 123].wont_be_written_to subject, :unit
|
21
|
+
end
|
22
|
+
|
23
|
+
it "symbolizes and downcases values" do
|
24
|
+
subject.tap { |s| s.unit = "P" }.unit.must_equal :p
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
describe :to_p do
|
29
|
+
it "leaves pascal untouched" do
|
30
|
+
subject = AIXM.p(2, :p)
|
31
|
+
subject.to_p.must_be_same_as subject
|
32
|
+
end
|
33
|
+
|
34
|
+
it "converts megapascal to pascal" do
|
35
|
+
AIXM.p(0.01, :mpa).to_p.must_equal AIXM.p(10_000, :p)
|
36
|
+
end
|
37
|
+
|
38
|
+
it "converts psi to pascal" do
|
39
|
+
AIXM.p(0.03, :psi).to_p.must_equal AIXM.p(206.8427187, :p)
|
40
|
+
end
|
41
|
+
|
42
|
+
it "converts bar to pascal" do
|
43
|
+
AIXM.p(0.02, :bar).to_p.must_equal AIXM.p(2000, :p)
|
44
|
+
end
|
45
|
+
|
46
|
+
it "converts mmhg to pascal" do
|
47
|
+
AIXM.p(0.02, :torr).to_p.must_equal AIXM.p(2.66644, :p)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
describe :to_mpa do
|
52
|
+
it "leaves megapascal untouched" do
|
53
|
+
subject = AIXM.p(2, :mpa)
|
54
|
+
subject.to_mpa.must_be_same_as subject
|
55
|
+
end
|
56
|
+
|
57
|
+
it "converts pascal to megapascal" do
|
58
|
+
AIXM.p(10_000, :p).to_mpa.must_equal AIXM.p(0.01, :mpa)
|
59
|
+
end
|
60
|
+
|
61
|
+
it "converts psi to megapascal" do
|
62
|
+
AIXM.p(300, :psi).to_mpa.must_equal AIXM.p(2.06842719, :mpa)
|
63
|
+
end
|
64
|
+
|
65
|
+
it "converts bar to megapascal" do
|
66
|
+
AIXM.p(22, :bar).to_mpa.must_equal AIXM.p(2.2, :mpa)
|
67
|
+
end
|
68
|
+
|
69
|
+
it "converts mmhg to megapascal" do
|
70
|
+
AIXM.p(205, :torr).to_mpa.must_equal AIXM.p(0.02733101, :mpa)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
describe :to_psi do
|
75
|
+
it "leaves psi untouched" do
|
76
|
+
subject = AIXM.p(2, :psi)
|
77
|
+
subject.to_psi.must_be_same_as subject
|
78
|
+
end
|
79
|
+
|
80
|
+
it "converts pascal to psi" do
|
81
|
+
AIXM.p(500, :p).to_psi.must_equal AIXM.p(0.07251887, :psi)
|
82
|
+
end
|
83
|
+
|
84
|
+
it "converts megapascal to psi" do
|
85
|
+
AIXM.p(0.1, :mpa).to_psi.must_equal AIXM.p(14.5037738, :psi)
|
86
|
+
end
|
87
|
+
|
88
|
+
it "converts bar to psi" do
|
89
|
+
AIXM.p(30, :bar).to_psi.must_equal AIXM.p(435.113214, :psi)
|
90
|
+
end
|
91
|
+
|
92
|
+
it "converts mmhg to psi" do
|
93
|
+
AIXM.p(20, :torr).to_psi.must_equal AIXM.p(0.38673443, :psi)
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
describe :to_bar do
|
98
|
+
it "leaves bars untouched" do
|
99
|
+
subject = AIXM.p(2, :bar)
|
100
|
+
subject.to_bar.must_be_same_as subject
|
101
|
+
end
|
102
|
+
|
103
|
+
it "converts pascal to bars" do
|
104
|
+
AIXM.p(10_000, :p).to_bar.must_equal AIXM.p(0.1, :bar)
|
105
|
+
end
|
106
|
+
|
107
|
+
it "converts megapascal to bars" do
|
108
|
+
AIXM.p(0.1, :mpa).to_bar.must_equal AIXM.p(1, :bar)
|
109
|
+
end
|
110
|
+
|
111
|
+
it "converts psi to bars" do
|
112
|
+
AIXM.p(90, :psi).to_bar.must_equal AIXM.p(6.20528156, :bar)
|
113
|
+
end
|
114
|
+
|
115
|
+
it "converts mmhg to bars" do
|
116
|
+
AIXM.p(7000, :torr).to_bar.must_equal AIXM.p(9.33254, :bar)
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
describe :to_torr do
|
121
|
+
it "leaves mmhg untouched" do
|
122
|
+
subject = AIXM.p(2, :torr)
|
123
|
+
subject.to_torr.must_be_same_as subject
|
124
|
+
end
|
125
|
+
|
126
|
+
it "converts pascal to mmhg" do
|
127
|
+
AIXM.p(12_000, :p).to_torr.must_equal AIXM.p(90.0072, :torr)
|
128
|
+
end
|
129
|
+
|
130
|
+
it "converts megapascal to mmhg" do
|
131
|
+
AIXM.p(0.1, :mpa).to_torr.must_equal AIXM.p(750.06, :torr)
|
132
|
+
end
|
133
|
+
|
134
|
+
it "converts psi to mmhg" do
|
135
|
+
AIXM.p(2, :psi).to_torr.must_equal AIXM.p(103.42963306, :torr)
|
136
|
+
end
|
137
|
+
|
138
|
+
it "converts bar to mmhg" do
|
139
|
+
AIXM.p(0.35, :bar).to_torr.must_equal AIXM.p(262.521, :torr)
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
describe :<=> do
|
144
|
+
it "recognizes objects with identical unit and pressure as equal" do
|
145
|
+
a = AIXM.p(12, :bar)
|
146
|
+
b = AIXM.p(12.0, 'BAR')
|
147
|
+
a.must_equal b
|
148
|
+
end
|
149
|
+
|
150
|
+
it "recognizes objects with different units and converted pressure as equal" do
|
151
|
+
a = AIXM.p(12, :bar)
|
152
|
+
b = AIXM.p(174.0452856, 'PSI')
|
153
|
+
a.must_equal b
|
154
|
+
end
|
155
|
+
|
156
|
+
it "recognizes objects with different units and identical pressure as unequal" do
|
157
|
+
a = AIXM.p(12, :bar)
|
158
|
+
b = AIXM.p(12, :p)
|
159
|
+
a.wont_equal b
|
160
|
+
end
|
161
|
+
|
162
|
+
it "recognizes objects of different class as unequal" do
|
163
|
+
a = AIXM.p(12, :bar)
|
164
|
+
b = :oggy
|
165
|
+
a.wont_equal b
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
169
|
+
describe :hash do
|
170
|
+
it "returns an integer" do
|
171
|
+
subject.hash.must_be_instance_of Integer
|
172
|
+
end
|
173
|
+
|
174
|
+
it "allows for the use of instances as hash keys" do
|
175
|
+
dupe = subject.dup
|
176
|
+
{ subject => true }[dupe].must_equal true
|
177
|
+
end
|
178
|
+
end
|
179
|
+
|
180
|
+
describe :zero? do
|
181
|
+
it "returns true for zero pressure" do
|
182
|
+
subject.tap { |s| s.pres = 0 }.must_be :zero?
|
183
|
+
end
|
184
|
+
|
185
|
+
it "returns false for non-zero pressure" do
|
186
|
+
subject.tap { |s| s.pres = 1 }.wont_be :zero?
|
187
|
+
end
|
188
|
+
end
|
189
|
+
end
|
@@ -4,22 +4,6 @@ using AIXM::Refinements
|
|
4
4
|
|
5
5
|
describe AIXM::Refinements do
|
6
6
|
|
7
|
-
context Object do
|
8
|
-
describe :then_if do
|
9
|
-
subject do
|
10
|
-
"foobar"
|
11
|
-
end
|
12
|
-
|
13
|
-
it "must return self if the condition is false" do
|
14
|
-
subject.then_if(false) { |s| s.gsub(/o/, 'i') }.must_equal subject
|
15
|
-
end
|
16
|
-
|
17
|
-
it "must return apply the block if the condition is true" do
|
18
|
-
subject.then_if(true) { |s| s.gsub(/o/, 'i') }.must_equal 'fiibar'
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
7
|
context Array do
|
24
8
|
describe :to_digest do
|
25
9
|
it "must digest single string" do
|
@@ -171,6 +155,22 @@ describe AIXM::Refinements do
|
|
171
155
|
end
|
172
156
|
end
|
173
157
|
|
158
|
+
context Object do
|
159
|
+
describe :then_if do
|
160
|
+
subject do
|
161
|
+
"foobar"
|
162
|
+
end
|
163
|
+
|
164
|
+
it "must return self if the condition is false" do
|
165
|
+
subject.then_if(false) { |s| s.gsub(/o/, 'i') }.must_equal subject
|
166
|
+
end
|
167
|
+
|
168
|
+
it "must return apply the block if the condition is true" do
|
169
|
+
subject.then_if(true) { |s| s.gsub(/o/, 'i') }.must_equal 'fiibar'
|
170
|
+
end
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
174
174
|
context Regexp do
|
175
175
|
describe :decapture do
|
176
176
|
it "should replace capture groups with non-capture groups" do
|