paper_trail 2.2.1 → 2.2.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -602,6 +602,7 @@ Many thanks to:
602
602
  * [benzittlau](https://github.com/benzittlau)
603
603
  * [Tom Derks](https://github.com/EgoH)
604
604
  * [Jonas Hoglund](https://github.com/jhoglund)
605
+ * [Stefan Huber](https://github.com/MSNexploder)
605
606
 
606
607
 
607
608
  ## Inspirations
data/lib/paper_trail.rb CHANGED
@@ -63,8 +63,11 @@ module PaperTrail
63
63
  private
64
64
 
65
65
  # Thread-safe hash to hold PaperTrail's data.
66
+ # Initializing with needed default values.
66
67
  def self.paper_trail_store
67
- Thread.current[:paper_trail] ||= {}
68
+ Thread.current[:paper_trail] ||= {
69
+ :request_enabled_for_controller => true
70
+ }
68
71
  end
69
72
 
70
73
  # Returns PaperTrail's configuration object.
@@ -1,3 +1,3 @@
1
1
  module PaperTrail
2
- VERSION = '2.2.1'
2
+ VERSION = '2.2.2'
3
3
  end
@@ -4,4 +4,24 @@ class PaperTrailTest < ActiveSupport::TestCase
4
4
  test 'Sanity test' do
5
5
  assert_kind_of Module, PaperTrail
6
6
  end
7
+
8
+ test 'create with plain model class' do
9
+ widget = Widget.create
10
+ assert_equal 1, widget.versions.length
11
+ end
12
+
13
+ test 'update with plain model class' do
14
+ widget = Widget.create
15
+ assert_equal 1, widget.versions.length
16
+ widget.update_attributes(:name => 'Bugle')
17
+ assert_equal 2, widget.versions.length
18
+ end
19
+
20
+ test 'destroy with plain model class' do
21
+ widget = Widget.create
22
+ assert_equal 1, widget.versions.length
23
+ widget.destroy
24
+ versions_for_widget = Version.with_item_keys('Widget', widget.id)
25
+ assert_equal 2, versions_for_widget.length
26
+ end
7
27
  end
data/test/test_helper.rb CHANGED
@@ -29,6 +29,12 @@ ActiveRecord::Migrator.migrate File.expand_path("../dummy/db/migrate/", __FILE__
29
29
  # Load support files
30
30
  Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
31
31
 
32
+ # global setup block resetting Thread.current
33
+ class ActiveSupport::TestCase
34
+ teardown do
35
+ Thread.current[:paper_trail] = nil
36
+ end
37
+ end
32
38
 
33
39
  #
34
40
  # Helpers
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paper_trail
3
3
  version: !ruby/object:Gem::Version
4
- hash: 5
4
+ hash: 3
5
5
  prerelease: false
6
6
  segments:
7
7
  - 2
8
8
  - 2
9
- - 1
10
- version: 2.2.1
9
+ - 2
10
+ version: 2.2.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Andy Stewart
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-04-06 00:00:00 +01:00
18
+ date: 2011-04-07 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency