pg_audit_log 0.6.1 → 0.6.2

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: 3a44d380da2ae044f211eb1ef93271c533bb7873
4
- data.tar.gz: ba9618687337d3f033319baa07f7fb59e0662c8f
3
+ metadata.gz: 924d22fb7b34cf8d77d2b73f2c18195731d0da64
4
+ data.tar.gz: 19640f9a6f1ddbc464b705c0a994bf051eddb2d3
5
5
  SHA512:
6
- metadata.gz: a10362edd035d160eeb5e086628b9b6017c63c5c66794f17029b1103770f1b5054b244737b1facc835c31c57d2f4101665bc46185e6b2a5d5ab507a359e0cd64
7
- data.tar.gz: 56e04973995ef7e880148a6daa5de455b6252c8de0db7864b1974aadc3129311876dd3f3b1f830e936c7450cd20e3383ccdf23435996f6427b826ecba71852db
6
+ metadata.gz: affe074c0f10332d56ac57f831d4a6b0e38379d6fb674bab44a1c11bda617606e94c99f72e31e5ff025308b0afa7b8a2dda64f33d6e24927e9d3c7abfc7715c4
7
+ data.tar.gz: 3e9adb9a60b4e09f3c666f5129e077dbc56671ce7ca998d1d2295134dd27c3b3f1a6f2cf06d07742f1deae472c4e2f262b9f89c89173af714bc1acf69af958cb
@@ -13,9 +13,9 @@ class ActiveRecord::ConnectionAdapters::PostgreSQLAdapter
13
13
  def create_table_with_auditing(table_name, options = {}, &block)
14
14
  create_table_without_auditing(table_name, options, &block)
15
15
  unless options[:temporary] ||
16
- PgAuditLog::IGNORED_TABLES.include?(table_name) ||
17
- PgAuditLog::IGNORED_TABLES.any? { |table| table =~ table_name if table.is_a? Regexp } ||
18
- PgAuditLog::Triggers.tables_with_triggers.include?(table_name)
16
+ PgAuditLog::IGNORED_TABLES.include?(table_name) ||
17
+ PgAuditLog::IGNORED_TABLES.any? { |table| table =~ table_name if table.is_a? Regexp } ||
18
+ PgAuditLog::Triggers.tables_with_triggers.include?(table_name)
19
19
  PgAuditLog::Triggers.create_for_table(table_name)
20
20
  end
21
21
  end
@@ -26,7 +26,9 @@ class ActiveRecord::ConnectionAdapters::PostgreSQLAdapter
26
26
  PgAuditLog::Triggers.drop_for_table(table_name)
27
27
  end
28
28
  rename_table_without_auditing(table_name, new_name)
29
- unless PgAuditLog::IGNORED_TABLES.include?(table_name) || PgAuditLog::Triggers.tables_with_triggers.include?(new_name)
29
+ unless PgAuditLog::IGNORED_TABLES.include?(table_name) ||
30
+ PgAuditLog::IGNORED_TABLES.any? { |table| table =~ table_name if table.is_a? Regexp } ||
31
+ PgAuditLog::Triggers.tables_with_triggers.include?(new_name)
30
32
  PgAuditLog::Triggers.create_for_table(new_name)
31
33
  end
32
34
  end
@@ -1,3 +1,3 @@
1
1
  module PgAuditLog
2
- VERSION = '0.6.1'.freeze
2
+ VERSION = '0.6.2'.freeze
3
3
  end
@@ -279,6 +279,21 @@ describe PgAuditLog do
279
279
 
280
280
  connection.drop_table(new_table_name) rescue nil
281
281
  end
282
+
283
+ context "and the new table name is ignored on the ignore list" do
284
+ it "should not create a new trigger" do
285
+ PgAuditLog::IGNORED_TABLES << /ignored_table/
286
+ new_table_name = "ignored_table_#{Time.current.to_i}"
287
+ connection.create_table('ignored_table')
288
+ connection.rename_table('ignored_table', new_table_name)
289
+
290
+ trigger_names.should_not include('audit_ignored_table')
291
+ trigger_names.should_not include("audit_#{new_table_name}")
292
+ PgAuditLog::Triggers.tables_with_triggers.should_not include(new_table_name)
293
+
294
+ connection.drop_table(new_table_name) rescue nil
295
+ end
296
+ end
282
297
  end
283
298
  end
284
299
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pg_audit_log
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Case Commons, LLC
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-24 00:00:00.000000000 Z
11
+ date: 2014-10-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails