vestal_versions 0.8.1 → 0.8.2

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.8.1
1
+ 0.8.2
@@ -54,11 +54,11 @@ module LaserLemon
54
54
  module InstanceMethods
55
55
  private
56
56
  def versioned_columns
57
- @versioned_columns ||= case
57
+ case
58
58
  when version_only_columns then self.class.column_names & version_only_columns
59
59
  when version_except_columns then self.class.column_names - version_except_columns
60
60
  else self.class.column_names
61
- end
61
+ end - %w(created_at created_on updated_at updated_on)
62
62
  end
63
63
 
64
64
  def needs_initial_version?
@@ -110,10 +110,8 @@ module LaserLemon
110
110
  backward = chain.first > chain.last
111
111
  backward ? chain.pop : chain.shift
112
112
 
113
- timestamps = %w(created_at created_on updated_at updated_on)
114
-
115
113
  chain.inject({}) do |changes, version|
116
- version.changes.except(*timestamps).each do |attribute, change|
114
+ version.changes.each do |attribute, change|
117
115
  change.reverse! if backward
118
116
  new_change = [changes.fetch(attribute, change).first, change.last]
119
117
  changes.update(attribute => new_change)
data/test/changes_test.rb CHANGED
@@ -17,13 +17,6 @@ class ChangesTest < Test::Unit::TestCase
17
17
  assert_equal changes, @user.versions.last.changes.slice(*changes.keys)
18
18
  end
19
19
 
20
- should 'contain timestamp changes when applicable' do
21
- timestamp = 'updated_at'
22
- @user.update_attribute(:name, 'Steve Jobs')
23
- assert @user.class.content_columns.map(&:name).include?(timestamp)
24
- assert_contains @user.versions.last.changes.keys, timestamp
25
- end
26
-
27
20
  should 'contain no more than the changed attributes and timestamps' do
28
21
  timestamps = %w(created_at created_on updated_at updated_on)
29
22
  @user.name = 'Steve Jobs'
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{vestal_versions}
8
- s.version = "0.8.1"
8
+ s.version = "0.8.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["laserlemon"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vestal_versions
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - laserlemon