mongo_mapper_versioned 0.1.3 → 0.1.4
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.
@@ -41,10 +41,6 @@ module MongoMapper
|
|
41
41
|
self.version_number == versions.last.version_number
|
42
42
|
end
|
43
43
|
|
44
|
-
def previous_version
|
45
|
-
Version.where(:versioned_id => self.id, :version_number => self.version_number-1).first
|
46
|
-
end
|
47
|
-
|
48
44
|
def current_version
|
49
45
|
Version.new(:data => self.attributes.slice!(*ignored_keys), :versioned_id => self.id, :version_number => self.version_number)
|
50
46
|
end
|
@@ -32,9 +32,6 @@ class VersionedTest < ActiveSupport::TestCase
|
|
32
32
|
should "be last version" do
|
33
33
|
assert @doc.last_version?
|
34
34
|
end
|
35
|
-
should "have no previous version" do
|
36
|
-
assert_nil @doc.previous_version
|
37
|
-
end
|
38
35
|
end
|
39
36
|
|
40
37
|
context "when created" do
|
@@ -50,9 +47,6 @@ class VersionedTest < ActiveSupport::TestCase
|
|
50
47
|
should "be last version" do
|
51
48
|
assert @doc.last_version?
|
52
49
|
end
|
53
|
-
should "have no previous version" do
|
54
|
-
assert_nil @doc.previous_version
|
55
|
-
end
|
56
50
|
|
57
51
|
context "when saved with no changes" do
|
58
52
|
setup do
|
@@ -69,9 +63,6 @@ class VersionedTest < ActiveSupport::TestCase
|
|
69
63
|
should "be last version" do
|
70
64
|
assert @doc.last_version?
|
71
65
|
end
|
72
|
-
should "have no previous version" do
|
73
|
-
assert_nil @doc.previous_version
|
74
|
-
end
|
75
66
|
end
|
76
67
|
|
77
68
|
context "after a change" do
|
@@ -90,9 +81,6 @@ class VersionedTest < ActiveSupport::TestCase
|
|
90
81
|
should "be last version" do
|
91
82
|
assert @doc.last_version?
|
92
83
|
end
|
93
|
-
should "have previous version" do
|
94
|
-
assert_equal @doc.previous_version.version_number, @doc.version_number-1
|
95
|
-
end
|
96
84
|
end
|
97
85
|
|
98
86
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongo_mapper_versioned
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 4
|
10
|
+
version: 0.1.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Tomas Celizna
|