pg_audit_log 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -60,7 +60,7 @@ class ActiveRecord::ConnectionAdapters::PostgreSQLAdapter
60
60
 
61
61
  def create_table_with_auditing(table_name, options = {}, &block)
62
62
  create_table_without_auditing(table_name, options, &block)
63
- unless PgAuditLog::Triggers.tables_with_triggers.include?(table_name)
63
+ unless options[:temporary] || PgAuditLog::Triggers.tables_with_triggers.include?(table_name)
64
64
  PgAuditLog::Triggers.create_for_table(table_name)
65
65
  end
66
66
  end
@@ -69,7 +69,7 @@ class ActiveRecord::ConnectionAdapters::PostgreSQLAdapter
69
69
 
70
70
  def create_table_with_auditing(table_name, options = {}, &block)
71
71
  create_table_without_auditing(table_name, options, &block)
72
- unless PgAuditLog::Triggers.tables_with_triggers.include?(table_name)
72
+ unless options[:temporary] || PgAuditLog::Triggers.tables_with_triggers.include?(table_name)
73
73
  PgAuditLog::Triggers.create_for_table(table_name)
74
74
  end
75
75
  end
@@ -1,3 +1,3 @@
1
1
  module PgAuditLog
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end
@@ -1,6 +1,8 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
2
 
3
3
  describe PgAuditLog do
4
+ let(:connection) { ActiveRecord::Base.connection }
5
+
4
6
  describe "a model that is audited" do
5
7
  with_model :audited_model do
6
8
  table do |t|
@@ -223,7 +225,6 @@ describe PgAuditLog do
223
225
  end
224
226
 
225
227
  describe "during migrations" do
226
- let(:connection) { ActiveRecord::Base.connection }
227
228
 
228
229
  before do
229
230
  connection.drop_table("test_table") rescue nil
@@ -262,4 +263,21 @@ describe PgAuditLog do
262
263
  end
263
264
  end
264
265
 
266
+ describe "temporary tables" do
267
+ context "when creating them" do
268
+ it "should be ignored" do
269
+ connection.create_table("some_temp_table", :temporary => true)
270
+ PgAuditLog::Triggers.tables_with_triggers.should_not include("some_temp_table")
271
+ connection.drop_table("some_temp_table")
272
+ end
273
+ end
274
+ context "when dropping them" do
275
+ it "should be ignored" do
276
+ connection.create_table("some_temp_table", :temporary => true)
277
+ connection.drop_table("some_temp_table")
278
+ PgAuditLog::Triggers.tables_with_triggers.should_not include("some_temp_table")
279
+ end
280
+ end
281
+ end
282
+
265
283
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pg_audit_log
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-10-02 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
- requirement: &2164856600 !ruby/object:Gem::Requirement
16
+ requirement: &2160732480 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 3.0.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2164856600
24
+ version_requirements: *2160732480
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: pg
27
- requirement: &2164769800 !ruby/object:Gem::Requirement
27
+ requirement: &2160722080 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 0.9.0
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *2164769800
35
+ version_requirements: *2160722080
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rspec-rails
38
- requirement: &2164769120 !ruby/object:Gem::Requirement
38
+ requirement: &2160721340 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *2164769120
46
+ version_requirements: *2160721340
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: with_model
49
- requirement: &2164768300 !ruby/object:Gem::Requirement
49
+ requirement: &2160720160 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 0.1.3
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *2164768300
57
+ version_requirements: *2160720160
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: autotest
60
- requirement: &2164767660 !ruby/object:Gem::Requirement
60
+ requirement: &2160718760 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,7 +65,7 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *2164767660
68
+ version_requirements: *2160718760
69
69
  description: A completely transparent audit logging component for your application
70
70
  using a stored procedure and triggers. Comes with specs for your project and a rake
71
71
  task to generate the reverse SQL to undo changes logged
@@ -118,7 +118,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
118
118
  version: '0'
119
119
  segments:
120
120
  - 0
121
- hash: -4145320202553197092
121
+ hash: 4413488878039851492
122
122
  required_rubygems_version: !ruby/object:Gem::Requirement
123
123
  none: false
124
124
  requirements:
@@ -127,7 +127,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
127
127
  version: '0'
128
128
  segments:
129
129
  - 0
130
- hash: -4145320202553197092
130
+ hash: 4413488878039851492
131
131
  requirements: []
132
132
  rubyforge_project:
133
133
  rubygems_version: 1.8.10