memento 0.3.6 → 0.3.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1 @@
1
+ plugin
@@ -0,0 +1 @@
1
+ 1.9.3-p0
data/CHANGES.md CHANGED
@@ -1,6 +1,12 @@
1
1
  ### dev
2
2
 
3
- [full changelog](http://github.com/yolk/valvat/compare/v0.3.6...master)
3
+ [full changelog](http://github.com/yolk/valvat/compare/v0.3.7...master)
4
+
5
+ ### 0.3.7 / 2012-08-13
6
+
7
+ [full changelog](http://github.com/yolk/valvat/compare/v0.3.6...v0.3.7)
8
+
9
+ * Removed usage of ActiveRecord::Base#update_attribute for Rails 3.2.7 compatibility
4
10
 
5
11
  ### 0.3.6 / 2012-02-06
6
12
 
data/Gemfile CHANGED
@@ -1,8 +1,4 @@
1
1
  source "http://rubygems.org"
2
2
 
3
3
  # Specify your gem's dependencies in valvat.gemspec
4
- gemspec
5
-
6
- group :development do
7
- gem 'rake'
8
- end
4
+ gemspec
@@ -12,7 +12,8 @@ class Memento::Action::Destroy < Memento::Action::Base
12
12
  object.id = nil
13
13
  object.save!
14
14
  end
15
- state.update_attribute(:record, object)
15
+ state.record = object
16
+ state.save
16
17
  end
17
18
  end
18
19
 
@@ -1,3 +1,3 @@
1
1
  class Memento
2
- VERSION = "0.3.6"
2
+ VERSION = "0.3.7"
3
3
  end
@@ -17,10 +17,10 @@ Gem::Specification.new do |s|
17
17
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
18
18
  s.require_paths = ["lib"]
19
19
 
20
- s.add_dependency 'activerecord', '~> 3.0'
21
- s.add_dependency 'actionpack', '~> 3.0'
20
+ s.add_dependency 'activerecord', '~> 3.2.5'
21
+ s.add_dependency 'actionpack', '~> 3.2.5'
22
22
 
23
23
  s.add_development_dependency 'rspec', '>= 2.4.0'
24
- s.add_development_dependency 'sqlite3', '>= 1.3.3'
24
+ s.add_development_dependency 'sqlite3', '>= 1.3.5'
25
25
  end
26
26
 
@@ -36,7 +36,7 @@ describe Memento::Action::Create, "when object is created" do
36
36
  end
37
37
 
38
38
  it "should not undo the creatio if object was modified" do
39
- Project.last.update_attribute(:created_at, 1.minute.ago)
39
+ Project.last.update_attributes(:created_at => 1.minute.ago)
40
40
  undone = Memento::Session.last.undo
41
41
  Project.count.should eql(1)
42
42
  undone.first.should_not be_success
@@ -91,7 +91,7 @@ describe Memento::Action::Update do
91
91
  Memento.instance.memento(@user) do
92
92
  @project.update_attributes({:notes => "Bla\nBla!"})
93
93
  end
94
- Memento::State.last.update_attribute(:created_at, 1.minute.from_now)
94
+ Memento::State.last.update_attributes(:created_at => 1.minute.from_now)
95
95
  @result = Memento::Session.first.undo.first
96
96
  @object = @result.object
97
97
  end
@@ -156,7 +156,7 @@ describe Memento::Action::Update do
156
156
  Memento.instance.memento(@user) do
157
157
  @project.update_attributes!({:name => "P3"})
158
158
  end
159
- Memento::State.last.update_attribute(:created_at, 1.minute.from_now)
159
+ Memento::State.last.update_attributes(:created_at => 1.minute.from_now)
160
160
  @result = Memento::Session.first.undo.first
161
161
  @object = @result.object
162
162
  end
@@ -26,7 +26,7 @@ describe Memento::ActionControllerMethods do
26
26
  it "should call memento#memento with user and block" do
27
27
  project = Project.create!
28
28
  @controller.send(:memento) do
29
- project.update_attribute(:name, "P7")
29
+ project.update_attributes(:name => "P7")
30
30
  end
31
31
  project.reload.name.should eql("P7")
32
32
  project.memento_states.count.should eql(1)
@@ -34,7 +34,7 @@ describe Memento::ActionControllerMethods do
34
34
  end
35
35
 
36
36
  it "should set header X-MementoSessionId" do
37
- @controller.send(:memento) { Project.create!.update_attribute(:name, "P7") }
37
+ @controller.send(:memento) { Project.create!.update_attributes(:name => "P7") }
38
38
  @headers.should == {'X-Memento-Session-Id' => Memento::Session.last.id.to_s }
39
39
  end
40
40
 
@@ -20,7 +20,7 @@ describe Memento::ActiveRecordMethods do
20
20
  it "should set hook on update to call Memento" do
21
21
  project = Project.create!(:name => "Project X")
22
22
  Memento.instance.should_receive(:add_state).once().with("update", project)
23
- project.update_attribute(:name, "Project XY")
23
+ project.update_attributes(:name => "Project XY")
24
24
  end
25
25
 
26
26
  it "should set hook on destroy to call Memento" do
@@ -52,11 +52,11 @@ describe Memento::ActiveRecordMethods do
52
52
  it "should define has_many association to memento_states" do
53
53
  project = Project.create!(:name => "Project X")
54
54
  project.memento_states.should be_empty
55
- Memento.instance.memento(@user) { project.update_attribute(:name, "Project Y") }
55
+ Memento.instance.memento(@user) { project.update_attributes(:name => "Project Y") }
56
56
  project.memento_states.count.should eql(1)
57
- Memento.instance.memento(@user) { project.update_attribute(:name, "Project Y") }
57
+ Memento.instance.memento(@user) { project.update_attributes(:name => "Project Y") }
58
58
  project.memento_states.count.should eql(1)
59
- Memento.instance.memento(@user) { Project.create!.update_attribute(:name, "Project X") }
59
+ Memento.instance.memento(@user) { Project.create!.update_attributes(:name => "Project X") }
60
60
  project.memento_states.count.should eql(1)
61
61
  Project.last.memento_states.count.should eql(2)
62
62
  Memento::State.count.should eql(3)
@@ -47,10 +47,10 @@ describe Memento::Session do
47
47
 
48
48
  describe "and all states fail" do
49
49
  before do
50
- @state1.update_attribute(:record_data, {:name => ["A", "B"]})
51
- @p1.update_attribute(:name, "C")
52
- @state2.update_attribute(:record_data, {:name => ["A", "B"]})
53
- @p2.update_attribute(:name, "C")
50
+ @state1.update_attributes(:record_data => {:name => ["A", "B"]})
51
+ @p1.update_attributes(:name => "C")
52
+ @state2.update_attributes(:record_data => {:name => ["A", "B"]})
53
+ @p2.update_attributes(:name => "C")
54
54
  end
55
55
 
56
56
  it "should keep all states" do
@@ -70,8 +70,8 @@ describe Memento::Session do
70
70
 
71
71
  describe "and some states succeed, some fail" do
72
72
  before do
73
- @state1.update_attribute(:record_data, {:name => ["A", "B"]})
74
- @p1.update_attribute(:name, "C")
73
+ @state1.update_attributes(:record_data => {:name => ["A", "B"]})
74
+ @p1.update_attributes(:name => "C")
75
75
  end
76
76
 
77
77
  it "should keep all states when using undo!" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: memento
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.6
4
+ version: 0.3.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,33 +9,43 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-02-06 00:00:00.000000000 Z
12
+ date: 2012-08-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord
16
- requirement: &2159410640 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
20
20
  - !ruby/object:Gem::Version
21
- version: '3.0'
21
+ version: 3.2.5
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2159410640
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: 3.2.5
25
30
  - !ruby/object:Gem::Dependency
26
31
  name: actionpack
27
- requirement: &2159409900 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
28
33
  none: false
29
34
  requirements:
30
35
  - - ~>
31
36
  - !ruby/object:Gem::Version
32
- version: '3.0'
37
+ version: 3.2.5
33
38
  type: :runtime
34
39
  prerelease: false
35
- version_requirements: *2159409900
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: 3.2.5
36
46
  - !ruby/object:Gem::Dependency
37
47
  name: rspec
38
- requirement: &2159409060 !ruby/object:Gem::Requirement
48
+ requirement: !ruby/object:Gem::Requirement
39
49
  none: false
40
50
  requirements:
41
51
  - - ! '>='
@@ -43,18 +53,28 @@ dependencies:
43
53
  version: 2.4.0
44
54
  type: :development
45
55
  prerelease: false
46
- version_requirements: *2159409060
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: 2.4.0
47
62
  - !ruby/object:Gem::Dependency
48
63
  name: sqlite3
49
- requirement: &2159408600 !ruby/object:Gem::Requirement
64
+ requirement: !ruby/object:Gem::Requirement
50
65
  none: false
51
66
  requirements:
52
67
  - - ! '>='
53
68
  - !ruby/object:Gem::Version
54
- version: 1.3.3
69
+ version: 1.3.5
55
70
  type: :development
56
71
  prerelease: false
57
- version_requirements: *2159408600
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: 1.3.5
58
78
  description: Undo for Rails/ActiveRecord - covers destroy, update and create
59
79
  email: sebastian@yo.lk
60
80
  executables: []
@@ -62,6 +82,8 @@ extensions: []
62
82
  extra_rdoc_files: []
63
83
  files:
64
84
  - .gitignore
85
+ - .rbenv-gemsets
86
+ - .rbenv-version
65
87
  - CHANGES.md
66
88
  - Gemfile
67
89
  - LICENSE
@@ -113,7 +135,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
113
135
  version: '0'
114
136
  requirements: []
115
137
  rubyforge_project:
116
- rubygems_version: 1.8.10
138
+ rubygems_version: 1.8.23
117
139
  signing_key:
118
140
  specification_version: 3
119
141
  summary: Undo for Rails/ActiveRecord - covers destroy, update and create