purgatory 2.9.0 → 2.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/README.markdown +1 -0
- data/VERSION +1 -1
- data/lib/purgatory/purgatory.rb +7 -3
- data/purgatory.gemspec +3 -3
- data/spec/purgatory_spec.rb +10 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NGM4ZmQxNjc1Mjc5ZDMwNDA3YmI0OWUzM2NlNjY0NTlhNTZhZTdhOA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MjU5ZDdjNzI3MjI3Njg5MzE0ZTBhOGY4MjU2OWRhZGFkNDc2M2VjZQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZjA4ZDBlMjA2NmNiZTliNjZhNmM2NzM0ZDUxMjc4ZjIyOTcyODkzZjg5ZTky
|
10
|
+
MzE3YTJhOTAwOGU1ZDFkMWY0N2UxNjJlZmI5NjdiOWMzYzM2ZTc3NTgyYmYw
|
11
|
+
ZmNkYTMzM2VmNTExOWI3ZmJlMTRjN2Q5MTUyNGIwNTg0MWZlMDA=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZmM2ZTJmM2NkYWM1ZjM2YmM2NzczYTkzMmYzMDQxMDY1Yjk1YTAwZTk4NGU4
|
14
|
+
MmUwNjkzZGY3Mjk2MjRiYjExZWU1MmJmMmM1Nzc4YzJlYWE3ZjljOGJiYjM0
|
15
|
+
NmQ2NTNlMWQzNTc0OTA0YTc0MDU3M2RmNzhmZWE1NWMyZGNiOTY=
|
data/README.markdown
CHANGED
@@ -58,6 +58,7 @@ Here are some handy class and instance methods available to you:
|
|
58
58
|
### Instance methods
|
59
59
|
purgatory.pending? # Returns true if the purgatory is pending, false otherwise
|
60
60
|
purgatory.approved? # Returns true if the purgatory has been approved, false otherwise
|
61
|
+
purgatory.soul_with_changes # Returns the soul with the changes applied (not saved)
|
61
62
|
|
62
63
|
### ActiveRecord Lifecycle
|
63
64
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.10.0
|
data/lib/purgatory/purgatory.rb
CHANGED
@@ -36,11 +36,15 @@ class Purgatory < ActiveRecord::Base
|
|
36
36
|
requested_changes['type'].try(:last)
|
37
37
|
end
|
38
38
|
|
39
|
-
def
|
40
|
-
return false if approved?
|
39
|
+
def soul_with_changes
|
41
40
|
requested_changes.each{|k,v| soul.send(:write_attribute, k, v[1])}
|
42
41
|
attr_accessor_fields.each{|k,v| soul.instance_variable_set(k, v)}
|
43
|
-
|
42
|
+
soul
|
43
|
+
end
|
44
|
+
|
45
|
+
def approve!(approver = nil)
|
46
|
+
return false if approved?
|
47
|
+
if soul_with_changes.save
|
44
48
|
self.approver = approver
|
45
49
|
self.approved_at = Time.now
|
46
50
|
save
|
data/purgatory.gemspec
CHANGED
@@ -2,15 +2,15 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: purgatory 2.
|
5
|
+
# stub: purgatory 2.10.0 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "purgatory"
|
9
|
-
s.version = "2.
|
9
|
+
s.version = "2.10.0"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.authors = ["Elan Dubrofsky"]
|
13
|
-
s.date = "2013-11-
|
13
|
+
s.date = "2013-11-29"
|
14
14
|
s.description = "Put your model changes in purgatory and allow them to remain lost souls until they are approved"
|
15
15
|
s.email = "elan.dubrofsky@gmail.com"
|
16
16
|
s.extra_rdoc_files = [
|
data/spec/purgatory_spec.rb
CHANGED
@@ -30,6 +30,12 @@ describe Purgatory do
|
|
30
30
|
@purgatory.requested_changes['price'].first.should == 100
|
31
31
|
@purgatory.requested_changes['price'].last.should == 200
|
32
32
|
end
|
33
|
+
|
34
|
+
it "should return soul with changes if requested" do
|
35
|
+
soul_with_changes = @purgatory.soul_with_changes
|
36
|
+
soul_with_changes.name.should == 'bar'
|
37
|
+
soul_with_changes.price.should == 200
|
38
|
+
end
|
33
39
|
|
34
40
|
it "should not change the widget" do
|
35
41
|
@widget.name.should == 'foo'
|
@@ -88,6 +94,10 @@ describe Purgatory do
|
|
88
94
|
it "should store the attr_accessor variables in the Purgatory object" do
|
89
95
|
@purgatory.attr_accessor_fields.should == { :@dante => "inferno" }
|
90
96
|
end
|
97
|
+
|
98
|
+
it "should return item with changed attr_accessor if requested" do
|
99
|
+
@purgatory.soul_with_changes.dante.should == 'inferno'
|
100
|
+
end
|
91
101
|
end
|
92
102
|
|
93
103
|
it "should not allow invalid changes to be put into purgatory" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: purgatory
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Elan Dubrofsky
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-11-
|
11
|
+
date: 2013-11-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rdoc
|