protokoll 0.1.1 → 0.1.2
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.
- data/README.rdoc +4 -1
- data/lib/protokoll/{protokoll_auto_increment.rb → auto_increment.rb} +14 -1
- data/lib/protokoll/version.rb +1 -1
- data/lib/protokoll.rb +15 -26
- data/test/dummy/log/test.log +19077 -0
- data/test/protokoll_test.rb +22 -22
- metadata +6 -6
data/test/protokoll_test.rb
CHANGED
@@ -6,18 +6,18 @@ class ProtokollTest < ActiveSupport::TestCase
|
|
6
6
|
time = Time.local(2011, 9, 25, 12, 0, 0)
|
7
7
|
Timecop.travel(time)
|
8
8
|
|
9
|
-
Protocol.
|
9
|
+
Protocol.protokoll.count = 0
|
10
10
|
end
|
11
11
|
|
12
12
|
test "first using # should get 1" do
|
13
|
-
Protocol.
|
13
|
+
Protocol.protokoll.pattern = "#"
|
14
14
|
|
15
15
|
protocol = Protocol.create
|
16
16
|
assert_equal "1", protocol.number
|
17
17
|
end
|
18
18
|
|
19
19
|
test "second protocol on DB should have number should equals 2" do
|
20
|
-
Protocol.
|
20
|
+
Protocol.protokoll.pattern = "#"
|
21
21
|
|
22
22
|
Protocol.create
|
23
23
|
protocol = Protocol.create
|
@@ -25,7 +25,7 @@ class ProtokollTest < ActiveSupport::TestCase
|
|
25
25
|
end
|
26
26
|
|
27
27
|
test "third protocol on DB should have number should equals 3" do
|
28
|
-
Protocol.
|
28
|
+
Protocol.protokoll.pattern = "#"
|
29
29
|
|
30
30
|
protocol1 = Protocol.create
|
31
31
|
protocol2 = Protocol.create
|
@@ -34,14 +34,14 @@ class ProtokollTest < ActiveSupport::TestCase
|
|
34
34
|
end
|
35
35
|
|
36
36
|
test "first using format A# should get A1" do
|
37
|
-
Protocol.
|
37
|
+
Protocol.protokoll.pattern = "A#"
|
38
38
|
|
39
39
|
protocol1 = Protocol.create
|
40
40
|
assert_equal "A1", protocol1.number
|
41
41
|
end
|
42
42
|
|
43
43
|
test "second using format A# should get A2" do
|
44
|
-
Protocol.
|
44
|
+
Protocol.protokoll.pattern = "A#"
|
45
45
|
|
46
46
|
protocol1 = Protocol.create
|
47
47
|
protocol2 = Protocol.create
|
@@ -49,14 +49,14 @@ class ProtokollTest < ActiveSupport::TestCase
|
|
49
49
|
end
|
50
50
|
|
51
51
|
test "first using format A## should get A01" do
|
52
|
-
Protocol.
|
52
|
+
Protocol.protokoll.pattern = "A##"
|
53
53
|
|
54
54
|
protocol1 = Protocol.create
|
55
55
|
assert_equal "A01", protocol1.number
|
56
56
|
end
|
57
57
|
|
58
58
|
test "second using format A## should get A02" do
|
59
|
-
Protocol.
|
59
|
+
Protocol.protokoll.pattern = "A##"
|
60
60
|
|
61
61
|
protocol1 = Protocol.create
|
62
62
|
protocol2 = Protocol.create
|
@@ -64,7 +64,7 @@ class ProtokollTest < ActiveSupport::TestCase
|
|
64
64
|
end
|
65
65
|
|
66
66
|
test "third using format A## should get A03" do
|
67
|
-
Protocol.
|
67
|
+
Protocol.protokoll.pattern = "A##"
|
68
68
|
|
69
69
|
protocol1 = Protocol.create
|
70
70
|
protocol2 = Protocol.create
|
@@ -73,28 +73,28 @@ class ProtokollTest < ActiveSupport::TestCase
|
|
73
73
|
end
|
74
74
|
|
75
75
|
test "first use of %y# should get 111" do
|
76
|
-
Protocol.
|
76
|
+
Protocol.protokoll.pattern = "%y#"
|
77
77
|
|
78
78
|
protocol1 = Protocol.create
|
79
79
|
assert_equal "111", protocol1.number
|
80
80
|
end
|
81
81
|
|
82
82
|
test "second use of %y## should get 1101" do
|
83
|
-
Protocol.
|
83
|
+
Protocol.protokoll.pattern = "%y##"
|
84
84
|
|
85
85
|
protocol1 = Protocol.create
|
86
86
|
assert_equal "1101", protocol1.number
|
87
87
|
end
|
88
88
|
|
89
89
|
test "first use of %y%m## should get 110901" do
|
90
|
-
Protocol.
|
90
|
+
Protocol.protokoll.pattern = "%y%m##"
|
91
91
|
|
92
92
|
protocol1 = Protocol.create
|
93
93
|
assert_equal "110901", protocol1.number
|
94
94
|
end
|
95
95
|
|
96
96
|
test "second use of %y%m## on next month after should get 111001" do
|
97
|
-
Protocol.
|
97
|
+
Protocol.protokoll.pattern = "%y%m##"
|
98
98
|
|
99
99
|
protocol1 = Protocol.create
|
100
100
|
|
@@ -106,7 +106,7 @@ class ProtokollTest < ActiveSupport::TestCase
|
|
106
106
|
end
|
107
107
|
|
108
108
|
test "%y%m%H#### should get 1109120001" do
|
109
|
-
Protocol.
|
109
|
+
Protocol.protokoll.pattern = "%y%m%H####"
|
110
110
|
|
111
111
|
protocol1 = Protocol.create
|
112
112
|
|
@@ -114,7 +114,7 @@ class ProtokollTest < ActiveSupport::TestCase
|
|
114
114
|
end
|
115
115
|
|
116
116
|
test "%y## on next year should get 1201" do
|
117
|
-
Protocol.
|
117
|
+
Protocol.protokoll.pattern = "%y##"
|
118
118
|
|
119
119
|
protocol1 = Protocol.create
|
120
120
|
time = Time.local(2012, 9, 25, 12, 3, 0)
|
@@ -126,7 +126,7 @@ class ProtokollTest < ActiveSupport::TestCase
|
|
126
126
|
end
|
127
127
|
|
128
128
|
test "500.time create using %y%m%H#### should get 1109120500" do
|
129
|
-
Protocol.
|
129
|
+
Protocol.protokoll.pattern = "%y%m%H####"
|
130
130
|
|
131
131
|
500.times { Protocol.create }
|
132
132
|
|
@@ -134,7 +134,7 @@ class ProtokollTest < ActiveSupport::TestCase
|
|
134
134
|
end
|
135
135
|
|
136
136
|
test "PROT%H%m%y#### should get PROT%H%m%y0001" do
|
137
|
-
Protocol.
|
137
|
+
Protocol.protokoll.pattern = "PROT%H%m%y####"
|
138
138
|
|
139
139
|
protocol1 = Protocol.create
|
140
140
|
|
@@ -142,7 +142,7 @@ class ProtokollTest < ActiveSupport::TestCase
|
|
142
142
|
end
|
143
143
|
|
144
144
|
test "PROT%Y%m%H#### should get PROT201109120001" do
|
145
|
-
Protocol.
|
145
|
+
Protocol.protokoll.pattern = "PROT%Y%m%H####"
|
146
146
|
|
147
147
|
protocol1 = Protocol.create
|
148
148
|
|
@@ -150,7 +150,7 @@ class ProtokollTest < ActiveSupport::TestCase
|
|
150
150
|
end
|
151
151
|
|
152
152
|
test "use of sufix ####PROTO should get 0001PROTO" do
|
153
|
-
Protocol.
|
153
|
+
Protocol.protokoll.pattern = "####PROTO"
|
154
154
|
|
155
155
|
protocol1 = Protocol.create
|
156
156
|
|
@@ -158,7 +158,7 @@ class ProtokollTest < ActiveSupport::TestCase
|
|
158
158
|
end
|
159
159
|
|
160
160
|
test "use of sufix %Y%M####PROTO on 12:03 should get 2011030001PROTO" do
|
161
|
-
Protocol.
|
161
|
+
Protocol.protokoll.pattern = "%Y%M####PROTO"
|
162
162
|
|
163
163
|
time = Time.local(2011, 9, 25, 12, 3, 0)
|
164
164
|
Timecop.travel(time)
|
@@ -169,7 +169,7 @@ class ProtokollTest < ActiveSupport::TestCase
|
|
169
169
|
end
|
170
170
|
|
171
171
|
test "use of sufix %Y%M####PROTO on 12:15 should get 2011150001PROTO" do
|
172
|
-
Protocol.
|
172
|
+
Protocol.protokoll.pattern = "%Y%M####PROTO"
|
173
173
|
|
174
174
|
time = Time.local(2011, 9, 25, 12, 15, 0)
|
175
175
|
Timecop.travel(time)
|
@@ -180,7 +180,7 @@ class ProtokollTest < ActiveSupport::TestCase
|
|
180
180
|
end
|
181
181
|
|
182
182
|
# test "Start application with populated db." do
|
183
|
-
# Protocol.
|
183
|
+
# Protocol.protokoll.pattern = "%Y%M####PROTO"
|
184
184
|
#
|
185
185
|
# Protocol.create
|
186
186
|
# Protocol.create
|
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.1.
|
4
|
+
version: 0.1.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2011-09-27 00:00:00.000000000Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
16
|
-
requirement: &
|
16
|
+
requirement: &70333207418880 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 3.1.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70333207418880
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: sqlite3
|
27
|
-
requirement: &
|
27
|
+
requirement: &70333207448920 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70333207448920
|
36
36
|
description: ! 'Rails gem to enable creation of autoincrement Time based string on
|
37
37
|
a model defined by a pattern. Ex: :pattern => ''P%y###'' produces: ''P2011001'',
|
38
38
|
''P2011002''...'
|
@@ -42,8 +42,8 @@ executables: []
|
|
42
42
|
extensions: []
|
43
43
|
extra_rdoc_files: []
|
44
44
|
files:
|
45
|
+
- lib/protokoll/auto_increment.rb
|
45
46
|
- lib/protokoll/extract_number.rb
|
46
|
-
- lib/protokoll/protokoll_auto_increment.rb
|
47
47
|
- lib/protokoll/version.rb
|
48
48
|
- lib/protokoll.rb
|
49
49
|
- lib/tasks/protokoll_tasks.rake
|