log_book 0.7.1 → 0.8.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -1
- data/Gemfile.lock +175 -115
- data/README.md +46 -0
- data/lib/log_book/plugin.rb +1 -0
- data/lib/log_book/utils.rb +2 -2
- data/lib/log_book/version.rb +1 -1
- data/log_book.gemspec +5 -4
- data/test/log_book_test.rb +40 -1
- data/test/plugin_test.rb +7 -1
- data/test/schema.rb +2 -1
- data/test/test_helper.rb +3 -3
- metadata +35 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 674b7990a64ade62474b02d49bbba0bf6492fd6f46cb4e241eaa26fadbc2eebc
|
4
|
+
data.tar.gz: 278ee443e63767f9d208ad84b2a8190331e18ce3f8d34e6f47901faa22a5103a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: afe1f9a8c7e8c66da9ed1e8b35bc1bc64ca1aa0bc328d6da99eb4aaa15893fc70bea553122a9e01d8cad9b21d50e324c140af3eadba2cfa3ccc99c2c3f537095
|
7
|
+
data.tar.gz: 89515ec389e3679ddeb52d06fc6dacfe42c2f45db2edd968c0aedc2a520eb124a8f48c4accd6ccb606fb96ef8362f4b4dea5cca345261376a0d1e4fe6939585b
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,173 +1,233 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
log_book (0.
|
4
|
+
log_book (0.7.1)
|
5
5
|
acts-as-taggable-on (>= 8.0)
|
6
6
|
rails (>= 6.0)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
actioncable (7.
|
12
|
-
actionpack (= 7.
|
13
|
-
activesupport (= 7.
|
11
|
+
actioncable (7.1.3.2)
|
12
|
+
actionpack (= 7.1.3.2)
|
13
|
+
activesupport (= 7.1.3.2)
|
14
14
|
nio4r (~> 2.0)
|
15
15
|
websocket-driver (>= 0.6.1)
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
16
|
+
zeitwerk (~> 2.6)
|
17
|
+
actionmailbox (7.1.3.2)
|
18
|
+
actionpack (= 7.1.3.2)
|
19
|
+
activejob (= 7.1.3.2)
|
20
|
+
activerecord (= 7.1.3.2)
|
21
|
+
activestorage (= 7.1.3.2)
|
22
|
+
activesupport (= 7.1.3.2)
|
22
23
|
mail (>= 2.7.1)
|
23
24
|
net-imap
|
24
25
|
net-pop
|
25
26
|
net-smtp
|
26
|
-
actionmailer (7.
|
27
|
-
actionpack (= 7.
|
28
|
-
actionview (= 7.
|
29
|
-
activejob (= 7.
|
30
|
-
activesupport (= 7.
|
27
|
+
actionmailer (7.1.3.2)
|
28
|
+
actionpack (= 7.1.3.2)
|
29
|
+
actionview (= 7.1.3.2)
|
30
|
+
activejob (= 7.1.3.2)
|
31
|
+
activesupport (= 7.1.3.2)
|
31
32
|
mail (~> 2.5, >= 2.5.4)
|
32
33
|
net-imap
|
33
34
|
net-pop
|
34
35
|
net-smtp
|
35
|
-
rails-dom-testing (~> 2.
|
36
|
-
actionpack (7.
|
37
|
-
actionview (= 7.
|
38
|
-
activesupport (= 7.
|
39
|
-
|
36
|
+
rails-dom-testing (~> 2.2)
|
37
|
+
actionpack (7.1.3.2)
|
38
|
+
actionview (= 7.1.3.2)
|
39
|
+
activesupport (= 7.1.3.2)
|
40
|
+
nokogiri (>= 1.8.5)
|
41
|
+
racc
|
42
|
+
rack (>= 2.2.4)
|
43
|
+
rack-session (>= 1.0.1)
|
40
44
|
rack-test (>= 0.6.3)
|
41
|
-
rails-dom-testing (~> 2.
|
42
|
-
rails-html-sanitizer (~> 1.
|
43
|
-
actiontext (7.
|
44
|
-
actionpack (= 7.
|
45
|
-
activerecord (= 7.
|
46
|
-
activestorage (= 7.
|
47
|
-
activesupport (= 7.
|
45
|
+
rails-dom-testing (~> 2.2)
|
46
|
+
rails-html-sanitizer (~> 1.6)
|
47
|
+
actiontext (7.1.3.2)
|
48
|
+
actionpack (= 7.1.3.2)
|
49
|
+
activerecord (= 7.1.3.2)
|
50
|
+
activestorage (= 7.1.3.2)
|
51
|
+
activesupport (= 7.1.3.2)
|
48
52
|
globalid (>= 0.6.0)
|
49
53
|
nokogiri (>= 1.8.5)
|
50
|
-
actionview (7.
|
51
|
-
activesupport (= 7.
|
54
|
+
actionview (7.1.3.2)
|
55
|
+
activesupport (= 7.1.3.2)
|
52
56
|
builder (~> 3.1)
|
53
|
-
erubi (~> 1.
|
54
|
-
rails-dom-testing (~> 2.
|
55
|
-
rails-html-sanitizer (~> 1.
|
56
|
-
activejob (7.
|
57
|
-
activesupport (= 7.
|
57
|
+
erubi (~> 1.11)
|
58
|
+
rails-dom-testing (~> 2.2)
|
59
|
+
rails-html-sanitizer (~> 1.6)
|
60
|
+
activejob (7.1.3.2)
|
61
|
+
activesupport (= 7.1.3.2)
|
58
62
|
globalid (>= 0.3.6)
|
59
|
-
activemodel (7.
|
60
|
-
activesupport (= 7.
|
61
|
-
activerecord (7.
|
62
|
-
activemodel (= 7.
|
63
|
-
activesupport (= 7.
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
63
|
+
activemodel (7.1.3.2)
|
64
|
+
activesupport (= 7.1.3.2)
|
65
|
+
activerecord (7.1.3.2)
|
66
|
+
activemodel (= 7.1.3.2)
|
67
|
+
activesupport (= 7.1.3.2)
|
68
|
+
timeout (>= 0.4.0)
|
69
|
+
activestorage (7.1.3.2)
|
70
|
+
actionpack (= 7.1.3.2)
|
71
|
+
activejob (= 7.1.3.2)
|
72
|
+
activerecord (= 7.1.3.2)
|
73
|
+
activesupport (= 7.1.3.2)
|
69
74
|
marcel (~> 1.0)
|
70
|
-
|
71
|
-
|
75
|
+
activesupport (7.1.3.2)
|
76
|
+
base64
|
77
|
+
bigdecimal
|
72
78
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
79
|
+
connection_pool (>= 2.2.5)
|
80
|
+
drb
|
73
81
|
i18n (>= 1.6, < 2)
|
74
82
|
minitest (>= 5.1)
|
83
|
+
mutex_m
|
75
84
|
tzinfo (~> 2.0)
|
76
|
-
acts-as-taggable-on (
|
77
|
-
activerecord (>= 6.
|
85
|
+
acts-as-taggable-on (10.0.0)
|
86
|
+
activerecord (>= 6.1, < 7.2)
|
78
87
|
assert_difference (1.0.0)
|
79
88
|
activesupport (>= 3.0.0)
|
89
|
+
base64 (0.2.0)
|
90
|
+
bigdecimal (3.1.7)
|
80
91
|
builder (3.2.4)
|
81
|
-
concurrent-ruby (1.
|
92
|
+
concurrent-ruby (1.2.3)
|
93
|
+
connection_pool (2.4.1)
|
82
94
|
crass (1.0.6)
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
95
|
+
date (3.3.4)
|
96
|
+
drb (2.2.1)
|
97
|
+
erubi (1.12.0)
|
98
|
+
globalid (1.2.1)
|
99
|
+
activesupport (>= 6.1)
|
100
|
+
i18n (1.14.4)
|
88
101
|
concurrent-ruby (~> 1.0)
|
89
|
-
io-
|
90
|
-
|
102
|
+
io-console (0.7.2)
|
103
|
+
irb (1.12.0)
|
104
|
+
rdoc
|
105
|
+
reline (>= 0.4.2)
|
106
|
+
loofah (2.22.0)
|
91
107
|
crass (~> 1.0.2)
|
92
|
-
nokogiri (>= 1.
|
93
|
-
mail (2.
|
108
|
+
nokogiri (>= 1.12.0)
|
109
|
+
mail (2.8.1)
|
94
110
|
mini_mime (>= 0.1.1)
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
111
|
+
net-imap
|
112
|
+
net-pop
|
113
|
+
net-smtp
|
114
|
+
marcel (1.0.4)
|
115
|
+
mini_mime (1.1.5)
|
116
|
+
minitest (5.22.3)
|
117
|
+
mocha (2.2.0)
|
118
|
+
ruby2_keywords (>= 0.0.5)
|
119
|
+
mutex_m (0.2.0)
|
120
|
+
net-imap (0.4.10)
|
121
|
+
date
|
102
122
|
net-protocol
|
103
|
-
|
104
|
-
net-pop (0.1.1)
|
105
|
-
digest
|
123
|
+
net-pop (0.1.2)
|
106
124
|
net-protocol
|
125
|
+
net-protocol (0.2.2)
|
107
126
|
timeout
|
108
|
-
net-
|
109
|
-
io-wait
|
110
|
-
timeout
|
111
|
-
net-smtp (0.3.1)
|
112
|
-
digest
|
127
|
+
net-smtp (0.5.0)
|
113
128
|
net-protocol
|
114
|
-
|
115
|
-
|
116
|
-
|
129
|
+
nio4r (2.7.1)
|
130
|
+
nokogiri (1.16.4-aarch64-linux)
|
131
|
+
racc (~> 1.4)
|
132
|
+
nokogiri (1.16.4-arm-linux)
|
133
|
+
racc (~> 1.4)
|
134
|
+
nokogiri (1.16.4-arm64-darwin)
|
135
|
+
racc (~> 1.4)
|
136
|
+
nokogiri (1.16.4-x86-linux)
|
137
|
+
racc (~> 1.4)
|
138
|
+
nokogiri (1.16.4-x86_64-darwin)
|
139
|
+
racc (~> 1.4)
|
140
|
+
nokogiri (1.16.4-x86_64-linux)
|
117
141
|
racc (~> 1.4)
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
142
|
+
psych (5.1.2)
|
143
|
+
stringio
|
144
|
+
racc (1.7.3)
|
145
|
+
rack (3.0.10)
|
146
|
+
rack-session (2.0.0)
|
147
|
+
rack (>= 3.0.0)
|
148
|
+
rack-test (2.1.0)
|
149
|
+
rack (>= 1.3)
|
150
|
+
rackup (2.1.0)
|
151
|
+
rack (>= 3)
|
152
|
+
webrick (~> 1.8)
|
153
|
+
rails (7.1.3.2)
|
154
|
+
actioncable (= 7.1.3.2)
|
155
|
+
actionmailbox (= 7.1.3.2)
|
156
|
+
actionmailer (= 7.1.3.2)
|
157
|
+
actionpack (= 7.1.3.2)
|
158
|
+
actiontext (= 7.1.3.2)
|
159
|
+
actionview (= 7.1.3.2)
|
160
|
+
activejob (= 7.1.3.2)
|
161
|
+
activemodel (= 7.1.3.2)
|
162
|
+
activerecord (= 7.1.3.2)
|
163
|
+
activestorage (= 7.1.3.2)
|
164
|
+
activesupport (= 7.1.3.2)
|
134
165
|
bundler (>= 1.15.0)
|
135
|
-
railties (= 7.
|
136
|
-
rails-dom-testing (2.0
|
137
|
-
activesupport (>=
|
166
|
+
railties (= 7.1.3.2)
|
167
|
+
rails-dom-testing (2.2.0)
|
168
|
+
activesupport (>= 5.0.0)
|
169
|
+
minitest
|
138
170
|
nokogiri (>= 1.6)
|
139
|
-
rails-html-sanitizer (1.
|
140
|
-
loofah (~> 2.
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
171
|
+
rails-html-sanitizer (1.6.0)
|
172
|
+
loofah (~> 2.21)
|
173
|
+
nokogiri (~> 1.14)
|
174
|
+
railties (7.1.3.2)
|
175
|
+
actionpack (= 7.1.3.2)
|
176
|
+
activesupport (= 7.1.3.2)
|
177
|
+
irb
|
178
|
+
rackup (>= 1.0.0)
|
145
179
|
rake (>= 12.2)
|
146
|
-
thor (~> 1.0)
|
147
|
-
zeitwerk (~> 2.
|
148
|
-
rake (13.
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
180
|
+
thor (~> 1.0, >= 1.2.2)
|
181
|
+
zeitwerk (~> 2.6)
|
182
|
+
rake (13.2.1)
|
183
|
+
rdoc (6.6.3.1)
|
184
|
+
psych (>= 4.0.0)
|
185
|
+
reline (0.5.2)
|
186
|
+
io-console (~> 0.5)
|
187
|
+
ruby2_keywords (0.0.5)
|
188
|
+
sqlite3 (1.7.3-aarch64-linux)
|
189
|
+
sqlite3 (1.7.3-arm-linux)
|
190
|
+
sqlite3 (1.7.3-arm64-darwin)
|
191
|
+
sqlite3 (1.7.3-x86-linux)
|
192
|
+
sqlite3 (1.7.3-x86_64-darwin)
|
193
|
+
sqlite3 (1.7.3-x86_64-linux)
|
194
|
+
stringio (3.1.0)
|
195
|
+
thor (1.3.1)
|
196
|
+
timecop (0.9.8)
|
197
|
+
timeout (0.4.1)
|
198
|
+
tzinfo (2.0.6)
|
154
199
|
concurrent-ruby (~> 1.0)
|
155
|
-
|
200
|
+
webrick (1.8.1)
|
201
|
+
websocket-driver (0.7.6)
|
156
202
|
websocket-extensions (>= 0.1.0)
|
157
203
|
websocket-extensions (0.1.5)
|
158
|
-
zeitwerk (2.
|
204
|
+
zeitwerk (2.6.13)
|
159
205
|
|
160
206
|
PLATFORMS
|
161
|
-
|
207
|
+
aarch64-linux
|
208
|
+
aarch64-linux-gnu
|
209
|
+
aarch64-linux-musl
|
210
|
+
arm-linux
|
211
|
+
arm-linux-gnu
|
212
|
+
arm-linux-musl
|
213
|
+
arm64-darwin
|
214
|
+
x86-linux
|
215
|
+
x86-linux-gnu
|
216
|
+
x86-linux-musl
|
217
|
+
x86_64-darwin
|
218
|
+
x86_64-linux
|
219
|
+
x86_64-linux-gnu
|
220
|
+
x86_64-linux-musl
|
162
221
|
|
163
222
|
DEPENDENCIES
|
164
223
|
assert_difference (>= 1.0)
|
165
224
|
bundler (>= 2.0)
|
166
225
|
log_book!
|
167
226
|
minitest (>= 5.1)
|
168
|
-
mocha (
|
227
|
+
mocha (~> 2.2)
|
169
228
|
rake (>= 0.13)
|
170
|
-
sqlite3 (
|
229
|
+
sqlite3 (~> 1.4)
|
230
|
+
timecop
|
171
231
|
|
172
232
|
BUNDLED WITH
|
173
|
-
2.
|
233
|
+
2.5.7
|
data/README.md
CHANGED
@@ -99,3 +99,49 @@ Use block configuration instead of `model.log_book_historian` do something like:
|
|
99
99
|
## Sate of the art
|
100
100
|
|
101
101
|
Beta version but already used in production environments
|
102
|
+
|
103
|
+
## In case your IDs are strings
|
104
|
+
|
105
|
+
Change the migration with this one in your project:
|
106
|
+
|
107
|
+
```
|
108
|
+
class CreateLogBookEventsUuidsSupport < ActiveRecord::Migration[4.2]
|
109
|
+
def self.up
|
110
|
+
create_table :log_book_events do |t|
|
111
|
+
t.string :historian_id
|
112
|
+
t.string :historian_type
|
113
|
+
t.string :historizable_id
|
114
|
+
t.string :historizable_type
|
115
|
+
t.text :differences, :limit => 16777215 # mediumtext
|
116
|
+
|
117
|
+
t.timestamps :null => false
|
118
|
+
end
|
119
|
+
|
120
|
+
add_index :log_book_events, [:historizable_id, :historizable_type, :created_at], :name => "index_log_book_events_on_historizable_and_created_at"
|
121
|
+
add_index :log_book_events, [:created_at]
|
122
|
+
end
|
123
|
+
|
124
|
+
def self.down
|
125
|
+
drop_table :log_book_events
|
126
|
+
end
|
127
|
+
end
|
128
|
+
```
|
129
|
+
|
130
|
+
## Development
|
131
|
+
|
132
|
+
### Running test
|
133
|
+
|
134
|
+
```
|
135
|
+
rake test
|
136
|
+
```
|
137
|
+
|
138
|
+
### Release new version
|
139
|
+
|
140
|
+
Update: `lib/log_book/version.rb`
|
141
|
+
|
142
|
+
```
|
143
|
+
git tag -a v[version] -m "Changelog..."
|
144
|
+
git push origin v[version]
|
145
|
+
gem build
|
146
|
+
gem push log_book-[version].gem
|
147
|
+
```
|
data/lib/log_book/plugin.rb
CHANGED
@@ -8,6 +8,7 @@ module LogBook::Plugin
|
|
8
8
|
def log_book(opts = {})
|
9
9
|
after_create :log_book_event_on_create
|
10
10
|
after_update :log_book_event_on_update
|
11
|
+
after_touch :log_book_event_on_update
|
11
12
|
before_destroy :log_book_event_on_destroy
|
12
13
|
|
13
14
|
has_many :log_book_events, :class_name => "LogBook::Event", :as => :historizable, :dependent => (opts[:dependent] || :nullify)
|
data/lib/log_book/utils.rb
CHANGED
@@ -12,8 +12,8 @@ module LogBook::Utils
|
|
12
12
|
old_value = v[0]
|
13
13
|
new_value = v[1]
|
14
14
|
|
15
|
-
old_value = old_value.
|
16
|
-
new_value = new_value.
|
15
|
+
old_value = old_value.utc.strftime("%Y-%m-%d %H:%M:%S") if old_value.is_a? Time
|
16
|
+
new_value = new_value.utc.strftime("%Y-%m-%d %H:%M:%S") if new_value.is_a? Time
|
17
17
|
|
18
18
|
{
|
19
19
|
"key" => k,
|
data/lib/log_book/version.rb
CHANGED
data/log_book.gemspec
CHANGED
@@ -21,10 +21,11 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.add_runtime_dependency "rails", ">= 6.0"
|
22
22
|
spec.add_runtime_dependency "acts-as-taggable-on", ">= 8.0"
|
23
23
|
|
24
|
-
spec.add_development_dependency "bundler", ">= 2.0"
|
25
|
-
spec.add_development_dependency "rake", ">= 0.13"
|
26
|
-
spec.add_development_dependency "mocha", ">= 1.13"
|
27
|
-
spec.add_development_dependency "sqlite3", ">= 1.0"
|
28
24
|
spec.add_development_dependency "assert_difference", ">= 1.0"
|
25
|
+
spec.add_development_dependency "bundler", ">= 2.0"
|
29
26
|
spec.add_development_dependency "minitest", ">= 5.1"
|
27
|
+
spec.add_development_dependency "mocha", "~> 2.2"
|
28
|
+
spec.add_development_dependency "rake", ">= 0.13"
|
29
|
+
spec.add_development_dependency "sqlite3", "~> 1.4"
|
30
|
+
spec.add_development_dependency "timecop"
|
30
31
|
end
|
data/test/log_book_test.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require_relative "test_helper"
|
2
2
|
|
3
|
-
class LogBookTest <
|
3
|
+
class LogBookTest < Minitest::Test
|
4
4
|
def setup
|
5
5
|
LogBook::Event.destroy_all
|
6
6
|
User.destroy_all
|
@@ -66,6 +66,22 @@ class LogBookTest < MiniTest::Test
|
|
66
66
|
@item.update!(:title => "Other Title")
|
67
67
|
end
|
68
68
|
|
69
|
+
def test_updated_datetime_field
|
70
|
+
item = Item.create(:open_at => "2024-01-02 03:04:05")
|
71
|
+
|
72
|
+
differences = [
|
73
|
+
{
|
74
|
+
"key" => "open_at",
|
75
|
+
"before" => "2024-01-02 03:04:05",
|
76
|
+
"after" => "2024-01-03 03:04:05"
|
77
|
+
}
|
78
|
+
]
|
79
|
+
|
80
|
+
LogBook.expects(:event).with(nil, item, differences, LogBook::OPERATIONS[:update])
|
81
|
+
|
82
|
+
item.update!(:open_at => "2024-01-03 03:04:05")
|
83
|
+
end
|
84
|
+
|
69
85
|
def test_updated_when_muted
|
70
86
|
LogBook.expects(:event).never
|
71
87
|
|
@@ -89,6 +105,29 @@ class LogBookTest < MiniTest::Test
|
|
89
105
|
item_with_opts.update!(:title => "Other Title", :my_counter => 10)
|
90
106
|
end
|
91
107
|
|
108
|
+
def test_touch
|
109
|
+
differences = [
|
110
|
+
{
|
111
|
+
"key" => "open_at",
|
112
|
+
"before" => nil,
|
113
|
+
"after" => "2024-04-01 10:11:12"
|
114
|
+
}
|
115
|
+
]
|
116
|
+
|
117
|
+
LogBook.expects(:event).with(@user, @item, differences, LogBook::OPERATIONS[:update])
|
118
|
+
|
119
|
+
Timecop.freeze("2024-04-01 10:11:12 UTC") do
|
120
|
+
@item.touch(:open_at)
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
def test_touch_when_muted
|
125
|
+
LogBook.expects(:event).never
|
126
|
+
|
127
|
+
@item.log_book_mute = true
|
128
|
+
@item.touch(:open_at)
|
129
|
+
end
|
130
|
+
|
92
131
|
def test_item_destroyed
|
93
132
|
LogBook.expects(:event).with(@user, @item, nil, LogBook::OPERATIONS[:destroy])
|
94
133
|
|
data/test/plugin_test.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require_relative "test_helper"
|
2
2
|
|
3
|
-
class PluginTest <
|
3
|
+
class PluginTest < Minitest::Test
|
4
4
|
def setup
|
5
5
|
LogBook::Event.destroy_all
|
6
6
|
User.destroy_all
|
@@ -27,4 +27,10 @@ class PluginTest < MiniTest::Test
|
|
27
27
|
LogBook.expects(:destroyed).with(@user, @item)
|
28
28
|
@item.destroy
|
29
29
|
end
|
30
|
+
|
31
|
+
def test_event_on_touch
|
32
|
+
@item.log_book_historian = @user
|
33
|
+
LogBook.expects(:updated).with(@user, @item)
|
34
|
+
@item.touch(:open_at)
|
35
|
+
end
|
30
36
|
end
|
data/test/schema.rb
CHANGED
@@ -6,6 +6,7 @@ ActiveRecord::Schema.define :version => 0 do
|
|
6
6
|
create_table :items, :force => true do |t|
|
7
7
|
t.string :title
|
8
8
|
t.integer :my_counter
|
9
|
+
t.datetime :open_at
|
9
10
|
end
|
10
11
|
|
11
12
|
# acts-as-taggable-on
|
@@ -29,4 +30,4 @@ ActiveRecord::Schema.define :version => 0 do
|
|
29
30
|
add_index 'taggings',
|
30
31
|
['tag_id', 'taggable_id', 'taggable_type', 'context', 'tagger_id', 'tagger_type'],
|
31
32
|
unique: true, name: 'taggings_idx'
|
32
|
-
end
|
33
|
+
end
|
data/test/test_helper.rb
CHANGED
@@ -6,7 +6,8 @@ require "acts-as-taggable-on"
|
|
6
6
|
|
7
7
|
# require "minitest/unit"
|
8
8
|
require "minitest/autorun"
|
9
|
-
require "mocha/
|
9
|
+
require "mocha/minitest"
|
10
|
+
require "timecop"
|
10
11
|
|
11
12
|
require_relative "../lib/log_book"
|
12
13
|
|
@@ -25,8 +26,7 @@ CreateLogBookEvents.up
|
|
25
26
|
load("#{File.dirname(__FILE__)}/schema.rb")
|
26
27
|
load("#{File.dirname(__FILE__)}/models.rb")
|
27
28
|
|
28
|
-
class
|
29
|
+
class Minitest::Test
|
29
30
|
include AssertDifference
|
30
31
|
FIXTURES = File.expand_path("#{File.dirname(__FILE__)}/fixtures")
|
31
32
|
end
|
32
|
-
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: log_book
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fernando Guillen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-04-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '8.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: assert_difference
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.0'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: bundler
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -53,75 +67,75 @@ dependencies:
|
|
53
67
|
- !ruby/object:Gem::Version
|
54
68
|
version: '2.0'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
70
|
+
name: minitest
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
58
72
|
requirements:
|
59
73
|
- - ">="
|
60
74
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
75
|
+
version: '5.1'
|
62
76
|
type: :development
|
63
77
|
prerelease: false
|
64
78
|
version_requirements: !ruby/object:Gem::Requirement
|
65
79
|
requirements:
|
66
80
|
- - ">="
|
67
81
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
82
|
+
version: '5.1'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: mocha
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
72
86
|
requirements:
|
73
|
-
- - "
|
87
|
+
- - "~>"
|
74
88
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
89
|
+
version: '2.2'
|
76
90
|
type: :development
|
77
91
|
prerelease: false
|
78
92
|
version_requirements: !ruby/object:Gem::Requirement
|
79
93
|
requirements:
|
80
|
-
- - "
|
94
|
+
- - "~>"
|
81
95
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
96
|
+
version: '2.2'
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
98
|
+
name: rake
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
86
100
|
requirements:
|
87
101
|
- - ">="
|
88
102
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
103
|
+
version: '0.13'
|
90
104
|
type: :development
|
91
105
|
prerelease: false
|
92
106
|
version_requirements: !ruby/object:Gem::Requirement
|
93
107
|
requirements:
|
94
108
|
- - ">="
|
95
109
|
- !ruby/object:Gem::Version
|
96
|
-
version: '
|
110
|
+
version: '0.13'
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
112
|
+
name: sqlite3
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
100
114
|
requirements:
|
101
|
-
- - "
|
115
|
+
- - "~>"
|
102
116
|
- !ruby/object:Gem::Version
|
103
|
-
version: '1.
|
117
|
+
version: '1.4'
|
104
118
|
type: :development
|
105
119
|
prerelease: false
|
106
120
|
version_requirements: !ruby/object:Gem::Requirement
|
107
121
|
requirements:
|
108
|
-
- - "
|
122
|
+
- - "~>"
|
109
123
|
- !ruby/object:Gem::Version
|
110
|
-
version: '1.
|
124
|
+
version: '1.4'
|
111
125
|
- !ruby/object:Gem::Dependency
|
112
|
-
name:
|
126
|
+
name: timecop
|
113
127
|
requirement: !ruby/object:Gem::Requirement
|
114
128
|
requirements:
|
115
129
|
- - ">="
|
116
130
|
- !ruby/object:Gem::Version
|
117
|
-
version: '
|
131
|
+
version: '0'
|
118
132
|
type: :development
|
119
133
|
prerelease: false
|
120
134
|
version_requirements: !ruby/object:Gem::Requirement
|
121
135
|
requirements:
|
122
136
|
- - ">="
|
123
137
|
- !ruby/object:Gem::Version
|
124
|
-
version: '
|
138
|
+
version: '0'
|
125
139
|
description: Storing an events log book
|
126
140
|
email:
|
127
141
|
- fguillen.mail@gmail.com
|
@@ -169,7 +183,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
169
183
|
- !ruby/object:Gem::Version
|
170
184
|
version: '0'
|
171
185
|
requirements: []
|
172
|
-
rubygems_version: 3.
|
186
|
+
rubygems_version: 3.5.7
|
173
187
|
signing_key:
|
174
188
|
specification_version: 4
|
175
189
|
summary: Storing an events log book
|