defoker 0.0.5 → 0.0.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/README.md +35 -0
- data/bin/defoker +17 -6
- data/lib/date_base_name.rb +6 -6
- data/lib/defoker/version.rb +1 -1
- data/lib/defoker_core.rb +43 -30
- data/lib/defoker_dsl.rb +2 -1
- data/lib/defoker_dsl_model.rb +4 -2
- data/spec/date_base_name_spec.rb +482 -482
- data/spec/defoker_core_spec.rb +21 -33
- metadata +2 -2
data/spec/defoker_core_spec.rb
CHANGED
@@ -20,10 +20,10 @@ describe Defoker::Core do
|
|
20
20
|
case_before c
|
21
21
|
|
22
22
|
# -- given --
|
23
|
-
|
23
|
+
# nothing
|
24
24
|
|
25
25
|
# -- when --
|
26
|
-
|
26
|
+
Defoker::Core.init
|
27
27
|
|
28
28
|
# -- then --
|
29
29
|
actual = File.read("./#{Defoker::DEFOKERFILE_PATH}")
|
@@ -74,11 +74,10 @@ describe Defoker::Core do
|
|
74
74
|
case_before c
|
75
75
|
|
76
76
|
# -- given --
|
77
|
-
defoker_core = Defoker::Core.new
|
78
77
|
Timecop.freeze(Time.local(c[:dummy_year], c[:dummy_month], c[:dummy_day]))
|
79
78
|
|
80
79
|
# -- when --
|
81
|
-
actual =
|
80
|
+
actual = Defoker::Core.today(additional: c[:additional])
|
82
81
|
|
83
82
|
# -- then --
|
84
83
|
expect(actual).to eq(c[:expected])
|
@@ -125,11 +124,10 @@ describe Defoker::Core do
|
|
125
124
|
case_before c
|
126
125
|
|
127
126
|
# -- given --
|
128
|
-
defoker_core = Defoker::Core.new
|
129
127
|
Timecop.travel(Time.local(c[:dummy_year], c[:dummy_month], c[:dummy_day]))
|
130
128
|
|
131
129
|
# -- when --
|
132
|
-
actual =
|
130
|
+
actual = Defoker::Core.tomorrow(additional: c[:additional])
|
133
131
|
|
134
132
|
# -- then --
|
135
133
|
expect(actual).to eq(c[:expected])
|
@@ -176,11 +174,10 @@ describe Defoker::Core do
|
|
176
174
|
case_before c
|
177
175
|
|
178
176
|
# -- given --
|
179
|
-
defoker_core = Defoker::Core.new
|
180
177
|
Timecop.travel(Time.local(c[:dummy_year], c[:dummy_month], c[:dummy_day]))
|
181
178
|
|
182
179
|
# -- when --
|
183
|
-
actual =
|
180
|
+
actual = Defoker::Core.yesterday(additional: c[:additional])
|
184
181
|
|
185
182
|
# -- then --
|
186
183
|
expect(actual).to eq(c[:expected])
|
@@ -225,10 +222,9 @@ describe Defoker::Core do
|
|
225
222
|
case_before c
|
226
223
|
|
227
224
|
# -- given --
|
228
|
-
defoker_core = Defoker::Core.new
|
229
225
|
|
230
226
|
# -- when --
|
231
|
-
actual =
|
227
|
+
actual = Defoker::Core.days(c[:date], count: c[:count], additional: c[:additional])
|
232
228
|
|
233
229
|
# -- then --
|
234
230
|
expect(actual).to eq(c[:expected])
|
@@ -275,11 +271,10 @@ describe Defoker::Core do
|
|
275
271
|
case_before c
|
276
272
|
|
277
273
|
# -- given --
|
278
|
-
defoker_core = Defoker::Core.new
|
279
274
|
Timecop.freeze(Time.local(c[:dummy_year], c[:dummy_month], c[:dummy_day]))
|
280
275
|
|
281
276
|
# -- when --
|
282
|
-
actual =
|
277
|
+
actual = Defoker::Core.this_month(additional: c[:additional])
|
283
278
|
|
284
279
|
# -- then --
|
285
280
|
expect(actual).to eq(c[:expected])
|
@@ -326,11 +321,10 @@ describe Defoker::Core do
|
|
326
321
|
case_before c
|
327
322
|
|
328
323
|
# -- given --
|
329
|
-
defoker_core = Defoker::Core.new
|
330
324
|
Timecop.freeze(Time.local(c[:dummy_year], c[:dummy_month], c[:dummy_day]))
|
331
325
|
|
332
326
|
# -- when --
|
333
|
-
actual =
|
327
|
+
actual = Defoker::Core.next_month(additional: c[:additional])
|
334
328
|
|
335
329
|
# -- then --
|
336
330
|
expect(actual).to eq(c[:expected])
|
@@ -377,11 +371,10 @@ describe Defoker::Core do
|
|
377
371
|
case_before c
|
378
372
|
|
379
373
|
# -- given --
|
380
|
-
defoker_core = Defoker::Core.new
|
381
374
|
Timecop.freeze(Time.local(c[:dummy_year], c[:dummy_month], c[:dummy_day]))
|
382
375
|
|
383
376
|
# -- when --
|
384
|
-
actual =
|
377
|
+
actual = Defoker::Core.previous_month(additional: c[:additional])
|
385
378
|
|
386
379
|
# -- then --
|
387
380
|
expect(actual).to eq(c[:expected])
|
@@ -426,10 +419,9 @@ describe Defoker::Core do
|
|
426
419
|
case_before c
|
427
420
|
|
428
421
|
# -- given --
|
429
|
-
defoker_core = Defoker::Core.new
|
430
422
|
|
431
423
|
# -- when --
|
432
|
-
actual =
|
424
|
+
actual = Defoker::Core.months(c[:month], count: c[:count], additional: c[:additional])
|
433
425
|
|
434
426
|
# -- then --
|
435
427
|
expect(actual).to eq(c[:expected])
|
@@ -476,11 +468,10 @@ describe Defoker::Core do
|
|
476
468
|
case_before c
|
477
469
|
|
478
470
|
# -- given --
|
479
|
-
defoker_core = Defoker::Core.new
|
480
471
|
Timecop.freeze(Time.local(c[:dummy_year], c[:dummy_month], c[:dummy_day]))
|
481
472
|
|
482
473
|
# -- when --
|
483
|
-
actual =
|
474
|
+
actual = Defoker::Core.this_year(additional: c[:additional])
|
484
475
|
|
485
476
|
# -- then --
|
486
477
|
expect(actual).to eq(c[:expected])
|
@@ -527,11 +518,10 @@ describe Defoker::Core do
|
|
527
518
|
case_before c
|
528
519
|
|
529
520
|
# -- given --
|
530
|
-
defoker_core = Defoker::Core.new
|
531
521
|
Timecop.freeze(Time.local(c[:dummy_year], c[:dummy_month], c[:dummy_day]))
|
532
522
|
|
533
523
|
# -- when --
|
534
|
-
actual =
|
524
|
+
actual = Defoker::Core.next_year(additional: c[:additional])
|
535
525
|
|
536
526
|
# -- then --
|
537
527
|
expect(actual).to eq(c[:expected])
|
@@ -578,11 +568,10 @@ describe Defoker::Core do
|
|
578
568
|
case_before c
|
579
569
|
|
580
570
|
# -- given --
|
581
|
-
defoker_core = Defoker::Core.new
|
582
571
|
Timecop.freeze(Time.local(c[:dummy_year], c[:dummy_month], c[:dummy_day]))
|
583
572
|
|
584
573
|
# -- when --
|
585
|
-
actual =
|
574
|
+
actual = Defoker::Core.previous_year(additional: c[:additional])
|
586
575
|
|
587
576
|
# -- then --
|
588
577
|
expect(actual).to eq(c[:expected])
|
@@ -627,10 +616,9 @@ describe Defoker::Core do
|
|
627
616
|
case_before c
|
628
617
|
|
629
618
|
# -- given --
|
630
|
-
defoker_core = Defoker::Core.new
|
631
619
|
|
632
620
|
# -- when --
|
633
|
-
actual =
|
621
|
+
actual = Defoker::Core.years(c[:year], count: c[:count], additional: c[:additional])
|
634
622
|
|
635
623
|
# -- then --
|
636
624
|
expect(actual).to eq(c[:expected])
|
@@ -669,7 +657,7 @@ base "hoge"
|
|
669
657
|
dummy_day: 1,
|
670
658
|
input: DEFOKER_CASE1_INPUT,
|
671
659
|
additional: '',
|
672
|
-
expected: '20140901'
|
660
|
+
expected: ['20140901', nil]
|
673
661
|
},
|
674
662
|
{
|
675
663
|
case_no: 2,
|
@@ -679,7 +667,7 @@ base "hoge"
|
|
679
667
|
dummy_day: 1,
|
680
668
|
input: DEFOKER_CASE1_INPUT,
|
681
669
|
additional: 'hoge',
|
682
|
-
expected: '20140901_hoge'
|
670
|
+
expected: ['20140901_hoge', nil]
|
683
671
|
},
|
684
672
|
{
|
685
673
|
case_no: 3,
|
@@ -689,7 +677,7 @@ base "hoge"
|
|
689
677
|
dummy_day: 1,
|
690
678
|
input: DEFOKER_CASE2_INPUT,
|
691
679
|
additional: '',
|
692
|
-
expected: '201409_hoge'
|
680
|
+
expected: ['201409_hoge', nil]
|
693
681
|
},
|
694
682
|
{
|
695
683
|
case_no: 4,
|
@@ -699,7 +687,7 @@ base "hoge"
|
|
699
687
|
dummy_day: 1,
|
700
688
|
input: DEFOKER_CASE2_INPUT,
|
701
689
|
additional: 'hige',
|
702
|
-
expected: '201409_hoge_hige'
|
690
|
+
expected: ['201409_hoge_hige', nil]
|
703
691
|
},
|
704
692
|
{
|
705
693
|
case_no: 5,
|
@@ -719,15 +707,15 @@ base "hoge"
|
|
719
707
|
case_before c
|
720
708
|
|
721
709
|
# -- given --
|
722
|
-
|
710
|
+
# nothing
|
723
711
|
Timecop.freeze(Time.local(c[:dummy_year], c[:dummy_month], c[:dummy_day]))
|
724
712
|
|
725
713
|
# -- when --
|
726
714
|
if c[:expect_error]
|
727
|
-
expect {
|
715
|
+
expect { Defoker::Core.rule(additional: c[:additional]) }.to raise_error(Defoker::DslNotExistError)
|
728
716
|
next
|
729
717
|
end
|
730
|
-
actual =
|
718
|
+
actual = Defoker::Core.rule(additional: c[:additional])
|
731
719
|
|
732
720
|
# -- then --
|
733
721
|
expect(actual).to eq(c[:expected])
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: defoker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- tbpgr
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-10-
|
11
|
+
date: 2014-10-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|