mongoid-audit_log 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NjAyNmMxNWY1NzY4ZDMxMjJkZDg5ZjNkOTQwY2MwNjhhZmU5N2EyZQ==
4
+ OTQ2YWM3MzI1ZTRlMjZjOTZhOWRjN2E5ZTFhOWY4NTRiZGFlNGQyZQ==
5
5
  data.tar.gz: !binary |-
6
- NjhiYmJkZDU5ZTk2NTY2NWYxYzQyMGFiZTg0NWZkMWY3NjMyNTlkMw==
6
+ NGU3Njg2NDY2MGM1ZTY4YzFlM2E5MTY4MDI4MmFmZTA5ODgwMzRkOQ==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- YWU2NzYyNTZjYTQwMWQyOTIwMTEyM2VjZWQzY2E4MjdmMDlhMDBlMDAzMmZh
10
- NTEwMDQ0MWI4M2RhMjUyZTAzMmFjNjU4NDZkY2YzNzE4YTk1YjU1YzU1YmRh
11
- Zjc2ODJiZGJjMTljZjMyZmQzYTU5Nzg5ZGQ0ZGM5OTgwMzFiYzI=
9
+ Mjc3MzBlNmY5NTIxZjhjZDI5MDZkZTQxZDc3OGJjMDNlMDQ2ZmE2MjBiNTgy
10
+ Yjk3MDAxZjliY2NiYjMzMmNhMjZjMTE2ZDRjODA5ZTMzNzBiZGY1MWUwZjZi
11
+ MTFkYjkxZjhkZDgxNjYwNTNmMDRlNTVjYWNiOGMwYmJlMzI0ZDM=
12
12
  data.tar.gz: !binary |-
13
- ZDY3N2IxYjI2MjRlMTVjYzMyNTIwMjIxNmJlNWU5NTk1ZjU4NGYwYjIyOTU1
14
- NGRkYzJlNzlkMDQ3ZDBhY2MyZjM2YjA2OGM0ZWZhZGJjNmJjMjhiN2E4ODA0
15
- NzY4OWFkMDk2MDBjNWFiYWI5NjMxNDI5MzAxNGUxYTRkYmY5N2Y=
13
+ NjIxNTUxYTZhOGY3OTE1ZTEyM2VkOWMyYjJjMDdhZmYwZTc4YmY3M2U5YzIy
14
+ MDExYTFhY2ZmYmY1ZmYyMmQ0ZTRiZTlhMGNkN2I1ZjY1OTZiMDVlNDEyYTE3
15
+ N2Y5YTQzNGRiZWFhYWFiZWU2NDg5NmIyODE2NzU1MTMwNzQ1OWU=
@@ -1,5 +1,5 @@
1
1
  module Mongoid
2
2
  module AuditLog
3
- VERSION = "0.0.4"
3
+ VERSION = "0.0.5"
4
4
  end
5
5
  end
@@ -32,6 +32,13 @@ module Mongoid
32
32
  Thread.current[:mongoid_audit_log_modifier] = nil
33
33
  end
34
34
 
35
+ def self.disable
36
+ tmp = Thread.current[:mongoid_audit_log_recording]
37
+ Thread.current[:mongoid_audit_log_recording] = false
38
+ yield
39
+ Thread.current[:mongoid_audit_log_recording] = tmp
40
+ end
41
+
35
42
  def self.recording?
36
43
  !!Thread.current[:mongoid_audit_log_recording]
37
44
  end
@@ -78,6 +78,21 @@ module Mongoid
78
78
  end
79
79
  end
80
80
 
81
+ describe '.disable' do
82
+ it 'can disable recording' do
83
+ AuditLog.record do
84
+ product = Product.create!(:name => 'Foo bar')
85
+
86
+ AuditLog.disable do
87
+ product.update_attributes(:name => 'Bar baz')
88
+ end
89
+
90
+ product.name.should == 'Bar baz'
91
+ product.audit_log_entries.count.should == 1
92
+ end
93
+ end
94
+ end
95
+
81
96
  describe 'callbacks' do
82
97
  let(:user) { User.create! }
83
98
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongoid-audit_log
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Crouse
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-14 00:00:00.000000000 Z
11
+ date: 2013-10-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mongoid