pg_audit_log 0.6.5 → 0.6.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 39800555b4fbeb58610d4c7725ed799ff18efb63
4
- data.tar.gz: 81c6d6c3c47ee07bb1444019308a381b33ab4b9b
3
+ metadata.gz: 7ec491dc91a88e95b3a62a99119d71b9880b1633
4
+ data.tar.gz: 5eb489c343b5d17208ae25a3f00ecc418d3aeecd
5
5
  SHA512:
6
- metadata.gz: 2149585c888bd5d143c872d61d18ed8f459a9b0a77a2953a244b5c39d20e71a9a53a6486c047525e6a80d68ccb8507fc4cb4b613d78b00fa489bcf1e0e7a8e62
7
- data.tar.gz: 3cf888d6c84efbca541ee57da5455e067744c155ebdc5bef8f669f6807951c6649761046c76e7b1a16097114efa87212a709ce6f90c64565051f4b0b321eedaf
6
+ metadata.gz: 83c89e0684320a261368562fbeb03167adc617814f858c59747787c3e775a57ea2d3783c8771561ead90692b3a8a7acaf30a5a3fe66ff5841aa7815424cc01e4
7
+ data.tar.gz: 5f29260cda979560c08e8a2cd76474363595daba8f1821f79c6148f555a5f839fd56c8b3badf7f86655376c0901cfb5860d9134760eeae5422144e5a2a4ba216
data/.gitignore CHANGED
@@ -1,10 +1,9 @@
1
- .vimlog
2
- *.gem
3
- *~
4
- .DS_Store
5
- .bundle
6
- .idea
7
- Gemfile.lock
8
- doc
9
- pkg/*
10
- tags
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
@@ -1,4 +1,5 @@
1
1
  language: ruby
2
+ sudo: false
2
3
 
3
4
  addons:
4
5
  postgresql: '9.3'
@@ -1,3 +1,8 @@
1
+ ### 0.6.6
2
+ - Bump Rails dependency to include all 4.2.x (@MrJaba)
3
+ - Fixed migration name to be .rb file (@MrJaba)
4
+
5
+
1
6
  ### 0.6.5
2
7
 
3
8
  - Introduce changelog.
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # pg_audit_log
2
2
 
3
- [![Build Status](https://secure.travis-ci.org/Casecommons/pg_audit_log.png?branch=master)](https://travis-ci.org/Casecommons/pg_audit_log)
3
+ [![Build Status](https://secure.travis-ci.org/Casecommons/pg_audit_log.svg?branch=master)](https://travis-ci.org/Casecommons/pg_audit_log)
4
4
  [![Code Climate](https://img.shields.io/codeclimate/github/Casecommons/pg_audit_log.svg?style=flat)](https://codeclimate.com/github/Casecommons/pg_audit_log)
5
5
  [![Gem Version](https://img.shields.io/gem/v/pg_audit_log.svg?style=flat)](https://rubygems.org/gems/pg_audit_log)
6
6
 
@@ -11,7 +11,7 @@ module PgAuditLog
11
11
 
12
12
  def install
13
13
  directory "lib/tasks"
14
- migration_template "migration.rb", "db/migrate/install_pg_audit_log"
14
+ migration_template "migration.rb", "db/migrate/install_pg_audit_log.rb"
15
15
  end
16
16
  end
17
17
  end
@@ -1,3 +1,3 @@
1
1
  module PgAuditLog
2
- VERSION = '0.6.5'.freeze
2
+ VERSION = '0.6.6'.freeze
3
3
  end
@@ -19,9 +19,9 @@ Gem::Specification.new do |spec|
19
19
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
20
  spec.require_paths = ['lib']
21
21
 
22
- spec.add_dependency 'rails', '>= 3.2', '<= 4.2'
22
+ spec.add_dependency 'rails', '>= 3.2', '< 4.3'
23
23
  spec.add_dependency 'pg', '>= 0.9.0'
24
- spec.add_development_dependency 'rspec', '2.14.1'
24
+ spec.add_development_dependency 'rspec', '~> 3.0'
25
25
  spec.add_development_dependency 'rspec-rails'
26
26
  spec.add_development_dependency 'with_model', '>= 0.1.3'
27
27
  end
@@ -6,6 +6,6 @@ describe "the PostgreSQL database" do
6
6
  end
7
7
 
8
8
  it "has an audit log table" do
9
- ActiveRecord::Base.connection.table_exists?('audit_log').should be_true
9
+ expect(ActiveRecord::Base.connection.table_exists?('audit_log')).to be_truthy
10
10
  end
11
11
  end
@@ -8,7 +8,7 @@ describe PgAuditLog::Function do
8
8
  PgAuditLog::Function.uninstall
9
9
  end
10
10
 
11
- it { should be_false }
11
+ it { is_expected.to be_falsey }
12
12
  end
13
13
 
14
14
  context "when it is" do
@@ -16,7 +16,7 @@ describe PgAuditLog::Function do
16
16
  PgAuditLog::Function.install
17
17
  end
18
18
 
19
- it { should be_true }
19
+ it { is_expected.to be_truthy }
20
20
  end
21
21
  end
22
22
 
@@ -26,27 +26,27 @@ describe PgAuditLog::Function do
26
26
 
27
27
  context "new style" do
28
28
  it "escapes the email" do
29
- subject.should_not match('SET')
29
+ expect(subject).not_to match('SET')
30
30
 
31
- subject.should match('FUNCTION')
32
- subject.should match("'o''connell@fred.com'::varchar")
31
+ expect(subject).to match('FUNCTION')
32
+ expect(subject).to match("'o''connell@fred.com'::varchar")
33
33
  end
34
34
  end
35
35
 
36
36
  context "old style" do
37
37
  before do
38
38
  Rails = double
39
- Rails.stub_chain(:configuration, :pg_audit_log_old_style_user_id).and_return(true)
39
+ allow(Rails).to receive_message_chain(:configuration, :pg_audit_log_old_style_user_id).and_return(true)
40
40
  end
41
41
 
42
42
  after { Object.send(:remove_const, :Rails) }
43
43
 
44
44
  it "escapes the email" do
45
- subject.should match('SET')
46
- subject.should match("'o''connell@fred.com'")
45
+ expect(subject).to match('SET')
46
+ expect(subject).to match("'o''connell@fred.com'")
47
47
 
48
- subject.should_not match('FUNCTION')
49
- subject.should_not match("'o''connell@fred.com'::varchar")
48
+ expect(subject).not_to match('FUNCTION')
49
+ expect(subject).not_to match("'o''connell@fred.com'::varchar")
50
50
  end
51
51
  end
52
52
  end
@@ -5,19 +5,19 @@ describe PgAuditLog::Entry do
5
5
 
6
6
  describe ".delete" do
7
7
  it "blows up because deleting audit logs is not allowed" do
8
- proc { PgAuditLog::Entry.delete(subject.id) }.should raise_error(PgAuditLog::Entry::CannotDeleteError)
8
+ expect { PgAuditLog::Entry.delete(subject.id) }.to raise_error(PgAuditLog::Entry::CannotDeleteError)
9
9
  end
10
10
  end
11
11
 
12
12
  describe ".delete_all" do
13
13
  it "blows up because deleting audit logs is not allowed" do
14
- proc { PgAuditLog::Entry.delete_all }.should raise_error(PgAuditLog::Entry::CannotDeleteError)
14
+ expect { PgAuditLog::Entry.delete_all }.to raise_error(PgAuditLog::Entry::CannotDeleteError)
15
15
  end
16
16
  end
17
17
 
18
18
  describe "#destroy" do
19
19
  it "blows up because deleting audit logs is not allowed" do
20
- proc { subject.destroy }.should raise_error(PgAuditLog::Entry::CannotDeleteError)
20
+ expect { subject.destroy }.to raise_error(PgAuditLog::Entry::CannotDeleteError)
21
21
  end
22
22
  end
23
23
  end
@@ -42,12 +42,32 @@ describe PgAuditLog do
42
42
  AuditedModel.create!(attributes)
43
43
  end
44
44
 
45
- it { should be }
46
- its(:occurred_at) { should be }
47
- its(:table_name) { should == AuditedModel.table_name }
48
- its(:field_name) { should == 'str' }
49
- its(:primary_key) { should == AuditedModel.last.id.to_s }
50
- its(:operation) { should == 'INSERT' }
45
+ it { is_expected.to be }
46
+
47
+ describe '#occurred_at' do
48
+ subject { super().occurred_at }
49
+ it { is_expected.to be }
50
+ end
51
+
52
+ describe '#table_name' do
53
+ subject { super().table_name }
54
+ it { is_expected.to eq(AuditedModel.table_name) }
55
+ end
56
+
57
+ describe '#field_name' do
58
+ subject { super().field_name }
59
+ it { is_expected.to eq('str') }
60
+ end
61
+
62
+ describe '#primary_key' do
63
+ subject { super().primary_key }
64
+ it { is_expected.to eq(AuditedModel.last.id.to_s) }
65
+ end
66
+
67
+ describe '#operation' do
68
+ subject { super().operation }
69
+ it { is_expected.to eq('INSERT') }
70
+ end
51
71
  end
52
72
 
53
73
  context "when a user is present, having just been changed" do
@@ -57,15 +77,29 @@ describe PgAuditLog do
57
77
  ActiveRecord::Persistence.instance_method(:save).bind(record).call # call save without transaction
58
78
  end
59
79
 
60
- its(:user_id) { should == 1 }
61
- its(:user_unique_name) { should == 'my current user' }
80
+ describe '#user_id' do
81
+ subject { super().user_id }
82
+ it { is_expected.to eq(1) }
83
+ end
84
+
85
+ describe '#user_unique_name' do
86
+ subject { super().user_unique_name }
87
+ it { is_expected.to eq('my current user') }
88
+ end
62
89
  end
63
90
 
64
91
  context "when no user is present" do
65
92
  before { AuditedModel.create!(attributes) }
66
93
 
67
- its(:user_id) { should == -1 }
68
- its(:user_unique_name) { should == 'UNKNOWN' }
94
+ describe '#user_id' do
95
+ subject { super().user_id }
96
+ it { is_expected.to eq(-1) }
97
+ end
98
+
99
+ describe '#user_unique_name' do
100
+ subject { super().user_unique_name }
101
+ it { is_expected.to eq('UNKNOWN') }
102
+ end
69
103
  end
70
104
 
71
105
  it "captures all new values for all fields" do
@@ -74,11 +108,11 @@ describe PgAuditLog do
74
108
  attributes.each do |field_name, value|
75
109
  entry = PgAuditLog::Entry.where(:field_name => field_name).last
76
110
  if field_name == :dt
77
- entry.field_value_new.should == value.strftime("%Y-%m-%d %H:%M:%S")
111
+ expect(entry.field_value_new).to eq(value.strftime("%Y-%m-%d %H:%M:%S"))
78
112
  else
79
- entry.field_value_new.should == value.to_s
113
+ expect(entry.field_value_new).to eq(value.to_s)
80
114
  end
81
- entry.field_value_old.should be_nil
115
+ expect(entry.field_value_old).to be_nil
82
116
  end
83
117
  end
84
118
  end
@@ -90,9 +124,17 @@ describe PgAuditLog do
90
124
 
91
125
  subject { PgAuditLog::Entry.where(:field_name => 'str').last }
92
126
 
93
- it { should be }
94
- its(:field_name) { should == 'str' }
95
- its(:primary_key) { should be_nil }
127
+ it { is_expected.to be }
128
+
129
+ describe '#field_name' do
130
+ subject { super().field_name }
131
+ it { is_expected.to eq('str') }
132
+ end
133
+
134
+ describe '#primary_key' do
135
+ subject { super().primary_key }
136
+ it { is_expected.to be_nil }
137
+ end
96
138
  end
97
139
  end
98
140
 
@@ -111,17 +153,35 @@ describe PgAuditLog do
111
153
  ActiveRecord::Persistence.instance_method(:save).bind(@model).call # call save without transaction
112
154
  end
113
155
 
114
- its(:user_id) { should == 1 }
115
- its(:user_unique_name) { should == 'my current user' }
156
+ describe '#user_id' do
157
+ subject { super().user_id }
158
+ it { is_expected.to eq(1) }
159
+ end
160
+
161
+ describe '#user_unique_name' do
162
+ subject { super().user_unique_name }
163
+ it { is_expected.to eq('my current user') }
164
+ end
116
165
  end
117
166
 
118
167
  context "when going from a value to a another value" do
119
168
  before { @model.update_attributes!(:str => 'bar') }
120
169
  subject { PgAuditLog::Entry.where(:field_name => 'str').last }
121
170
 
122
- its(:operation) { should == 'UPDATE' }
123
- its(:field_value_new) { should == 'bar' }
124
- its(:field_value_old) { should == 'foo' }
171
+ describe '#operation' do
172
+ subject { super().operation }
173
+ it { is_expected.to eq('UPDATE') }
174
+ end
175
+
176
+ describe '#field_value_new' do
177
+ subject { super().field_value_new }
178
+ it { is_expected.to eq('bar') }
179
+ end
180
+
181
+ describe '#field_value_old' do
182
+ subject { super().field_value_old }
183
+ it { is_expected.to eq('foo') }
184
+ end
125
185
  end
126
186
 
127
187
  context "when going from nil to a value" do
@@ -129,23 +189,37 @@ describe PgAuditLog do
129
189
  before { @model.update_attributes!(:txt => 'baz') }
130
190
  subject { PgAuditLog::Entry.where(:field_name => 'txt').last }
131
191
 
132
- its(:field_value_new) { should == 'baz' }
133
- its(:field_value_old) { should be_nil }
192
+ describe '#field_value_new' do
193
+ subject { super().field_value_new }
194
+ it { is_expected.to eq('baz') }
195
+ end
196
+
197
+ describe '#field_value_old' do
198
+ subject { super().field_value_old }
199
+ it { is_expected.to be_nil }
200
+ end
134
201
  end
135
202
 
136
203
  context "when going from a value to nil" do
137
204
  before { @model.update_attributes!(:str => nil) }
138
205
  subject { PgAuditLog::Entry.where(:field_name => 'str').last }
139
206
 
140
- its(:field_value_new) { should be_nil }
141
- its(:field_value_old) { should == 'foo' }
207
+ describe '#field_value_new' do
208
+ subject { super().field_value_new }
209
+ it { is_expected.to be_nil }
210
+ end
211
+
212
+ describe '#field_value_old' do
213
+ subject { super().field_value_old }
214
+ it { is_expected.to eq('foo') }
215
+ end
142
216
  end
143
217
 
144
218
  context "when the value does not change" do
145
219
  before { @model.update_attributes!(:str => 'foo') }
146
220
  subject { PgAuditLog::Entry.where(:field_name => 'str', :operation => 'UPDATE').last }
147
221
 
148
- it { should_not be }
222
+ it { is_expected.not_to be }
149
223
  end
150
224
 
151
225
  context "when the value is nil and does not change" do
@@ -153,7 +227,7 @@ describe PgAuditLog do
153
227
  before { @model.update_attributes!(:txt => nil) }
154
228
  subject { PgAuditLog::Entry.where(:field_name => 'txt', :operation => 'UPDATE').last }
155
229
 
156
- it { should_not be }
230
+ it { is_expected.not_to be }
157
231
  end
158
232
 
159
233
  context "when the value is a boolean" do
@@ -161,8 +235,15 @@ describe PgAuditLog do
161
235
  before { @model.update_attributes!(:bool => true) }
162
236
  subject { PgAuditLog::Entry.where(:field_name => 'bool', :operation => 'UPDATE').last }
163
237
 
164
- its(:field_value_new) { should == 'true' }
165
- its(:field_value_old) { should be_nil }
238
+ describe '#field_value_new' do
239
+ subject { super().field_value_new }
240
+ it { is_expected.to eq('true') }
241
+ end
242
+
243
+ describe '#field_value_old' do
244
+ subject { super().field_value_old }
245
+ it { is_expected.to be_nil }
246
+ end
166
247
  end
167
248
 
168
249
  context "going from false -> true" do
@@ -172,8 +253,15 @@ describe PgAuditLog do
172
253
  end
173
254
  subject { PgAuditLog::Entry.where(:field_name => 'bool', :operation => 'UPDATE').last }
174
255
 
175
- its(:field_value_new) { should == 'true' }
176
- its(:field_value_old) { should == 'false' }
256
+ describe '#field_value_new' do
257
+ subject { super().field_value_new }
258
+ it { is_expected.to eq('true') }
259
+ end
260
+
261
+ describe '#field_value_old' do
262
+ subject { super().field_value_old }
263
+ it { is_expected.to eq('false') }
264
+ end
177
265
  end
178
266
 
179
267
  context "going from true -> false" do
@@ -184,8 +272,15 @@ describe PgAuditLog do
184
272
  end
185
273
  subject { PgAuditLog::Entry.where(:field_name => 'bool', :operation => 'UPDATE').last }
186
274
 
187
- its(:field_value_new) { should == 'false' }
188
- its(:field_value_old) { should == 'true' }
275
+ describe '#field_value_new' do
276
+ subject { super().field_value_new }
277
+ it { is_expected.to eq('false') }
278
+ end
279
+
280
+ describe '#field_value_old' do
281
+ subject { super().field_value_old }
282
+ it { is_expected.to eq('true') }
283
+ end
189
284
  end
190
285
  end
191
286
  end
@@ -198,7 +293,10 @@ describe PgAuditLog do
198
293
 
199
294
  subject { PgAuditLog::Entry.where(:field_name => 'str').last }
200
295
 
201
- its(:primary_key) { should be_nil }
296
+ describe '#primary_key' do
297
+ subject { super().primary_key }
298
+ it { is_expected.to be_nil }
299
+ end
202
300
  end
203
301
  end
204
302
 
@@ -211,17 +309,20 @@ describe PgAuditLog do
211
309
 
212
310
  subject { PgAuditLog::Entry.where(:field_name => 'str').last }
213
311
 
214
- its(:operation) { should == 'DELETE' }
312
+ describe '#operation' do
313
+ subject { super().operation }
314
+ it { is_expected.to eq('DELETE') }
315
+ end
215
316
 
216
317
  it "captures all new values for all fields" do
217
318
  attributes.each do |field_name, value|
218
319
  entry = PgAuditLog::Entry.where(:field_name => field_name).last
219
320
  if field_name == :dt
220
- entry.field_value_old.should == value.strftime('%Y-%m-%d %H:%M:%S')
321
+ expect(entry.field_value_old).to eq(value.strftime('%Y-%m-%d %H:%M:%S'))
221
322
  else
222
- entry.field_value_old.should == value.to_s
323
+ expect(entry.field_value_old).to eq(value.to_s)
223
324
  end
224
- entry.field_value_new.should be_nil
325
+ expect(entry.field_value_new).to be_nil
225
326
  end
226
327
  end
227
328
  end
@@ -241,7 +342,10 @@ describe PgAuditLog do
241
342
 
242
343
  subject { PgAuditLog::Entry.where(:field_name => 'str').last }
243
344
 
244
- its(:primary_key) { should be_nil }
345
+ describe '#primary_key' do
346
+ subject { super().primary_key }
347
+ it { is_expected.to be_nil }
348
+ end
245
349
  end
246
350
  end
247
351
 
@@ -271,9 +375,9 @@ describe PgAuditLog do
271
375
 
272
376
  describe "when creating the table" do
273
377
  it "should automatically create the trigger" do
274
- PgAuditLog::Triggers.tables_with_triggers.should_not include('test_table')
378
+ expect(PgAuditLog::Triggers.tables_with_triggers).not_to include('test_table')
275
379
  connection.create_table('test_table')
276
- PgAuditLog::Triggers.tables_with_triggers.should include('test_table')
380
+ expect(PgAuditLog::Triggers.tables_with_triggers).to include('test_table')
277
381
  end
278
382
  end
279
383
 
@@ -281,7 +385,7 @@ describe PgAuditLog do
281
385
  it "should automatically drop the trigger" do
282
386
  connection.create_table('test_table')
283
387
  connection.drop_table('test_table')
284
- PgAuditLog::Triggers.tables_with_triggers.should_not include('test_table')
388
+ expect(PgAuditLog::Triggers.tables_with_triggers).not_to include('test_table')
285
389
  end
286
390
  end
287
391
 
@@ -299,9 +403,9 @@ describe PgAuditLog do
299
403
  connection.create_table('test_table')
300
404
  connection.rename_table('test_table', new_table_name)
301
405
 
302
- trigger_names.should_not include('audit_test_table')
303
- trigger_names.should include("audit_#{new_table_name}")
304
- PgAuditLog::Triggers.tables_with_triggers.should include(new_table_name)
406
+ expect(trigger_names).not_to include('audit_test_table')
407
+ expect(trigger_names).to include("audit_#{new_table_name}")
408
+ expect(PgAuditLog::Triggers.tables_with_triggers).to include(new_table_name)
305
409
 
306
410
  connection.drop_table(new_table_name) rescue nil
307
411
  end
@@ -313,9 +417,9 @@ describe PgAuditLog do
313
417
  connection.create_table('ignored_table')
314
418
  connection.rename_table('ignored_table', new_table_name)
315
419
 
316
- trigger_names.should_not include('audit_ignored_table')
317
- trigger_names.should_not include("audit_#{new_table_name}")
318
- PgAuditLog::Triggers.tables_with_triggers.should_not include(new_table_name)
420
+ expect(trigger_names).not_to include('audit_ignored_table')
421
+ expect(trigger_names).not_to include("audit_#{new_table_name}")
422
+ expect(PgAuditLog::Triggers.tables_with_triggers).not_to include(new_table_name)
319
423
 
320
424
  connection.drop_table(new_table_name) rescue nil
321
425
  end
@@ -327,7 +431,7 @@ describe PgAuditLog do
327
431
  context "when creating them" do
328
432
  it "should be ignored" do
329
433
  connection.create_table('some_temp_table', :temporary => true)
330
- PgAuditLog::Triggers.tables_with_triggers.should_not include('some_temp_table')
434
+ expect(PgAuditLog::Triggers.tables_with_triggers).not_to include('some_temp_table')
331
435
  connection.drop_table('some_temp_table')
332
436
  end
333
437
  end
@@ -336,7 +440,7 @@ describe PgAuditLog do
336
440
  it "should be ignored" do
337
441
  connection.create_table('some_temp_table', :temporary => true)
338
442
  connection.drop_table('some_temp_table')
339
- PgAuditLog::Triggers.tables_with_triggers.should_not include('some_temp_table')
443
+ expect(PgAuditLog::Triggers.tables_with_triggers).not_to include('some_temp_table')
340
444
  end
341
445
  end
342
446
  end
@@ -349,7 +453,7 @@ describe PgAuditLog do
349
453
  context "when creating a table" do
350
454
  it "should install the function then enable the trigger on the table" do
351
455
  connection.create_table('some_more_new_table')
352
- PgAuditLog::Triggers.tables_with_triggers.should include('some_more_new_table')
456
+ expect(PgAuditLog::Triggers.tables_with_triggers).to include('some_more_new_table')
353
457
  connection.drop_table('some_more_new_table')
354
458
  end
355
459
  end
@@ -362,9 +466,9 @@ describe PgAuditLog do
362
466
 
363
467
  context "when creating a table" do
364
468
  it "should install the entry table then enable the trigger on the table" do
365
- PgAuditLog::Entry.installed?.should be_false
469
+ expect(PgAuditLog::Entry.installed?).to be_falsey
366
470
  connection.create_table('another_table')
367
- PgAuditLog::Entry.installed?.should be_true
471
+ expect(PgAuditLog::Entry.installed?).to be_truthy
368
472
  connection.drop_table('another_table')
369
473
  end
370
474
  end
@@ -375,7 +479,7 @@ describe PgAuditLog do
375
479
  it "should not automatically create a trigger for it" do
376
480
  PgAuditLog::IGNORED_TABLES << 'ignored_table'
377
481
  connection.create_table('ignored_table')
378
- PgAuditLog::Triggers.tables_with_triggers.should_not include('ignored_table')
482
+ expect(PgAuditLog::Triggers.tables_with_triggers).not_to include('ignored_table')
379
483
  connection.drop_table('ignored_table')
380
484
  end
381
485
  end
@@ -384,7 +488,7 @@ describe PgAuditLog do
384
488
  it "should not automatically create a trigger for it" do
385
489
  PgAuditLog::IGNORED_TABLES << /ignored_table/
386
490
  connection.create_table('second_ignored_table')
387
- PgAuditLog::Triggers.tables_with_triggers.should_not include('second_ignored_table')
491
+ expect(PgAuditLog::Triggers.tables_with_triggers).not_to include('second_ignored_table')
388
492
  connection.drop_table('second_ignored_table')
389
493
  end
390
494
  end
@@ -28,23 +28,23 @@ describe PgAuditLog::Triggers do
28
28
  PgAuditLog::IGNORED_TABLES << /ignore/
29
29
  end
30
30
 
31
- it { should include(TableWithTriggers.table_name) }
32
- it { should include(TableWithoutTriggers.table_name) }
33
- it { should_not include(PgAuditLog::Entry.table_name) }
34
- it { should_not include(TableToIgnore.table_name) }
31
+ it { is_expected.to include(TableWithTriggers.table_name) }
32
+ it { is_expected.to include(TableWithoutTriggers.table_name) }
33
+ it { is_expected.not_to include(PgAuditLog::Entry.table_name) }
34
+ it { is_expected.not_to include(TableToIgnore.table_name) }
35
35
  end
36
36
 
37
37
  describe ".tables_with_triggers" do
38
38
  it "should return an array of all tables that do have an audit trigger installed" do
39
- PgAuditLog::Triggers.tables_with_triggers.should include(TableWithTriggers.table_name)
40
- PgAuditLog::Triggers.tables_with_triggers.should_not include(TableWithoutTriggers.table_name)
39
+ expect(PgAuditLog::Triggers.tables_with_triggers).to include(TableWithTriggers.table_name)
40
+ expect(PgAuditLog::Triggers.tables_with_triggers).not_to include(TableWithoutTriggers.table_name)
41
41
  end
42
42
  end
43
43
 
44
44
  describe ".tables_without_triggers" do
45
45
  it "should return an array of all tables that do not have an audit trigger installed" do
46
- PgAuditLog::Triggers.tables_without_triggers.should_not include(TableWithTriggers.table_name)
47
- PgAuditLog::Triggers.tables_without_triggers.should include(TableWithoutTriggers.table_name)
46
+ expect(PgAuditLog::Triggers.tables_without_triggers).not_to include(TableWithTriggers.table_name)
47
+ expect(PgAuditLog::Triggers.tables_without_triggers).to include(TableWithoutTriggers.table_name)
48
48
  end
49
49
  end
50
50
 
@@ -55,17 +55,17 @@ describe PgAuditLog::Triggers do
55
55
 
56
56
  describe ".install" do
57
57
  it "should work" do
58
- ->{
58
+ expect{
59
59
  PgAuditLog::Triggers.install
60
- }.should_not raise_error
60
+ }.not_to raise_error
61
61
  end
62
62
  end
63
63
 
64
64
  describe ".uninstall" do
65
65
  it "should work" do
66
- ->{
66
+ expect{
67
67
  PgAuditLog::Triggers.uninstall
68
- }.should_not raise_error
68
+ }.not_to raise_error
69
69
  end
70
70
  end
71
71
 
@@ -74,24 +74,24 @@ describe PgAuditLog::Triggers do
74
74
  context "when triggers are installed" do
75
75
  describe ".install" do
76
76
  it "should work" do
77
- ->{
77
+ expect{
78
78
  PgAuditLog::Triggers.install
79
- }.should_not raise_error
79
+ }.not_to raise_error
80
80
  end
81
81
  end
82
82
  describe ".uninstall" do
83
83
  it "should work" do
84
- ->{
84
+ expect{
85
85
  PgAuditLog::Triggers.uninstall
86
- }.should_not raise_error
86
+ }.not_to raise_error
87
87
  end
88
88
  end
89
89
 
90
90
  describe ".enable" do
91
91
  it "should not blow up" do
92
- ->{
92
+ expect{
93
93
  PgAuditLog::Triggers.enable
94
- }.should_not raise_error
94
+ }.not_to raise_error
95
95
  end
96
96
 
97
97
  it "should fire the audit" do
@@ -104,9 +104,9 @@ describe PgAuditLog::Triggers do
104
104
 
105
105
  describe ".disable" do
106
106
  it "should not blow up" do
107
- ->{
107
+ expect{
108
108
  PgAuditLog::Triggers.disable
109
- }.should_not raise_error
109
+ }.not_to raise_error
110
110
  end
111
111
 
112
112
  it "should not fire the audit" do
@@ -130,17 +130,17 @@ describe PgAuditLog::Triggers do
130
130
  expect {
131
131
  TableWithTriggers.create!
132
132
  }.to change(PgAuditLog::Entry, :count)
133
- PgAuditLog::Entry.last.user_id.should == -1
133
+ expect(PgAuditLog::Entry.last.user_id).to eq(-1)
134
134
  end
135
135
  end
136
136
 
137
137
  describe ".create_for_table" do
138
138
  context "for a table that already has a trigger" do
139
139
  it "should not blow up" do
140
- PgAuditLog::Triggers.tables_with_triggers.should include(TableWithTriggers.table_name)
141
- ->{
140
+ expect(PgAuditLog::Triggers.tables_with_triggers).to include(TableWithTriggers.table_name)
141
+ expect{
142
142
  PgAuditLog::Triggers.create_for_table(TableWithTriggers.table_name)
143
- }.should_not raise_error
143
+ }.not_to raise_error
144
144
  end
145
145
  end
146
146
  end
@@ -149,9 +149,9 @@ describe PgAuditLog::Triggers do
149
149
  context "for a table that has no trigger" do
150
150
  it "should not blow up" do
151
151
  PgAuditLog::Triggers.drop_for_table(TableWithTriggers.table_name)
152
- ->{
152
+ expect{
153
153
  PgAuditLog::Triggers.drop_for_table(TableWithTriggers.table_name)
154
- }.should_not raise_error
154
+ }.not_to raise_error
155
155
  end
156
156
  end
157
157
  end
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.5
4
+ version: 0.6.6
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-12-29 00:00:00.000000000 Z
11
+ date: 2016-03-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -17,9 +17,9 @@ dependencies:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '3.2'
20
- - - "<="
20
+ - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '4.2'
22
+ version: '4.3'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -27,9 +27,9 @@ dependencies:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
29
  version: '3.2'
30
- - - "<="
30
+ - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '4.2'
32
+ version: '4.3'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: pg
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -48,16 +48,16 @@ dependencies:
48
48
  name: rspec
49
49
  requirement: !ruby/object:Gem::Requirement
50
50
  requirements:
51
- - - '='
51
+ - - "~>"
52
52
  - !ruby/object:Gem::Version
53
- version: 2.14.1
53
+ version: '3.0'
54
54
  type: :development
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
57
57
  requirements:
58
- - - '='
58
+ - - "~>"
59
59
  - !ruby/object:Gem::Version
60
- version: 2.14.1
60
+ version: '3.0'
61
61
  - !ruby/object:Gem::Dependency
62
62
  name: rspec-rails
63
63
  requirement: !ruby/object:Gem::Requirement
@@ -98,7 +98,6 @@ extra_rdoc_files: []
98
98
  files:
99
99
  - ".gitignore"
100
100
  - ".rspec"
101
- - ".rvmrc"
102
101
  - ".travis.yml"
103
102
  - CHANGELOG.md
104
103
  - Gemfile
@@ -146,7 +145,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
146
145
  version: '0'
147
146
  requirements: []
148
147
  rubyforge_project:
149
- rubygems_version: 2.4.4
148
+ rubygems_version: 2.4.5
150
149
  signing_key:
151
150
  specification_version: 4
152
151
  summary: PostgreSQL-only database-level audit logging of all databases changes.
data/.rvmrc DELETED
@@ -1 +0,0 @@
1
- rvm 1.9.3-p0@pg_audit_log --create