protokoll 0.5.3 → 0.6.0

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.
@@ -131,7 +131,7 @@ class ProtokollTest < ActiveSupport::TestCase
131
131
  assert_equal "111", protocol1.number
132
132
  end
133
133
 
134
- #
134
+
135
135
  test "first use of %y%m## should get 110901" do
136
136
  class Protocol < ActiveRecord::Base
137
137
  protokoll :number, :pattern => "%y%m##"
@@ -140,7 +140,7 @@ class ProtokollTest < ActiveSupport::TestCase
140
140
  protocol1 = Protocol.create
141
141
  assert_equal "110901", protocol1.number
142
142
  end
143
- #
143
+
144
144
  test "using %y%m## on next month after should get 111001" do
145
145
  class Protocol < ActiveRecord::Base
146
146
  protokoll :number, :pattern => "%y%m##"
@@ -371,6 +371,23 @@ class ProtokollTest < ActiveSupport::TestCase
371
371
  assert_equal "20111002", protocol3.number
372
372
  end
373
373
 
374
+ test "counter should consider day in pattern" do
375
+ class Protocol < ActiveRecord::Base
376
+ protokoll :number, :pattern => "%Y%m%d##"
377
+ end
378
+
379
+ protocol1 = Protocol.create!
380
+ protocol2 = Protocol.create!
381
+
382
+ Timecop.travel(1.day)
383
+
384
+ protocol3 = Protocol.create!
385
+
386
+ assert_equal "2011092501", protocol1.number
387
+ assert_equal "2011092502", protocol2.number
388
+ assert_equal "2011092601", protocol3.number
389
+ end
390
+
374
391
  end
375
392
 
376
393
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: protokoll
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.3
4
+ version: 0.6.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-10-26 00:00:00.000000000 Z
12
+ date: 2014-09-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails