mongoid-audit_log 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 155cd76ed2ee5e3a9a6d9941f4c8d4b47cef005c
4
- data.tar.gz: e16bc334bc6531efb3ffb1e6f0a7af5a6b301904
3
+ metadata.gz: 8a23fe69b31245a25863c18baa7e5b63e0bc6f77
4
+ data.tar.gz: bfaa8b4c151f34bbf73450f6f3cff3ee97324f2a
5
5
  SHA512:
6
- metadata.gz: 5a8d97bb2479bf9f6a53cefd8f1c1a754c9dd9d1c00633c6e1aa76a3dd0a023996d08db19c2f6ad027bca8605056bf1b2e3a04f180aa8898f301cf106645521a
7
- data.tar.gz: 7fdeec856542dd3a3dd2e6ad95a96b8e945647942feecb8107f65d715c3b0220209538301db6edfc751213bc778fcbf8f17e7e0fe6829f5c46015ee8fd315a0a
6
+ metadata.gz: f480600994ca391062f7ba7fa3bec9b6c1b145667045d16613170447804bc591f7eb6ebed2fcd716d0191daec39bd63648d14092d5af1d954a3d6f3750212d07
7
+ data.tar.gz: febb0de492697fc27b09b81be726e19f464310c997f7b22288b01ed43b024ac7d5611e95165053f5995f2f51b0b1168d8394316669617e31160951c584cadb5c
@@ -27,6 +27,7 @@ module Mongoid
27
27
  Thread.current[:mongoid_audit_log_recording] = true
28
28
  Thread.current[:mongoid_audit_log_modifier] = modifier
29
29
  yield
30
+ ensure
30
31
  Thread.current[:mongoid_audit_log_recording] = nil
31
32
  Thread.current[:mongoid_audit_log_modifier] = nil
32
33
  end
@@ -35,6 +36,7 @@ module Mongoid
35
36
  tmp = Thread.current[:mongoid_audit_log_recording]
36
37
  Thread.current[:mongoid_audit_log_recording] = false
37
38
  yield
39
+ ensure
38
40
  Thread.current[:mongoid_audit_log_recording] = tmp
39
41
  end
40
42
 
@@ -1,5 +1,5 @@
1
1
  module Mongoid
2
2
  module AuditLog
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.1"
4
4
  end
5
5
  end
@@ -71,6 +71,27 @@ module Mongoid
71
71
  product.audit_log_entries.first.modifier.should == user
72
72
  end
73
73
  end
74
+
75
+ it 'properly unsets recording on failure' do
76
+ expect do
77
+ AuditLog.record do
78
+ raise
79
+ end
80
+ end.to raise_error(Exception)
81
+
82
+ AuditLog.recording?.should == false
83
+ end
84
+
85
+ it 'properly unsets modifier on failure' do
86
+ user = User.create!
87
+ expect do
88
+ AuditLog.record(user) do
89
+ raise
90
+ end
91
+ end.to raise_error(Exception)
92
+
93
+ AuditLog.current_modifier.should == nil
94
+ end
74
95
  end
75
96
 
76
97
  describe '.disable' do
metadata CHANGED
@@ -1,55 +1,55 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongoid-audit_log
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Crouse
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-05 00:00:00.000000000 Z
11
+ date: 2015-09-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mongoid
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '4.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '4.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '1.3'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.3'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  description: Stupid simple audit logging for Mongoid
@@ -59,8 +59,8 @@ executables: []
59
59
  extensions: []
60
60
  extra_rdoc_files: []
61
61
  files:
62
- - .gitignore
63
- - .rspec
62
+ - ".gitignore"
63
+ - ".rspec"
64
64
  - Gemfile
65
65
  - LICENSE.txt
66
66
  - README.md
@@ -87,17 +87,17 @@ require_paths:
87
87
  - lib
88
88
  required_ruby_version: !ruby/object:Gem::Requirement
89
89
  requirements:
90
- - - '>='
90
+ - - ">="
91
91
  - !ruby/object:Gem::Version
92
92
  version: 1.9.2
93
93
  required_rubygems_version: !ruby/object:Gem::Requirement
94
94
  requirements:
95
- - - '>='
95
+ - - ">="
96
96
  - !ruby/object:Gem::Version
97
97
  version: 1.3.6
98
98
  requirements: []
99
99
  rubyforge_project:
100
- rubygems_version: 2.4.1
100
+ rubygems_version: 2.4.5
101
101
  signing_key:
102
102
  specification_version: 4
103
103
  summary: No fancy versioning, undo, redo, etc. Just saves changes to Mongoid models