couchpillow 0.4.0 → 0.4.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cb55c110b2b546a414fc253680530a0be2d4525b
4
- data.tar.gz: 8aee488a67a464972655088b9976777f4a7649ae
3
+ metadata.gz: 68340b1c8ca93e9e114eb3a9af1bd96b705e4b0a
4
+ data.tar.gz: 0ba836b544c3ea80cc23f09b490cac0b0c8788ae
5
5
  SHA512:
6
- metadata.gz: d30b27dc47e70736de216834c2c93721dc536809f90adb06942daedf5ab6d98da0c04c438153a6defe3ecca3737c7599d96279f88335162d7ac831aab71b5c85
7
- data.tar.gz: 1c3e5a11b8098a3038e00026a3fc9c97060aaa4f6e50c189c9d4988f46fe689d9a3d29a37d5bcf320342122300b8278a7dcf3c22278796983a5bd5c1b0073967
6
+ metadata.gz: 1ccd1a7058ceae8a0978fa7f2dca06282246cc756651e929d144840bb9bf177e9b2e0dbc57fbe07dcccff7cd74d1a5bfedfa70706074558d4af3c60901bbe0ea
7
+ data.tar.gz: e56be83f06ef9f5e2cb9b8375772440dc59ac32040483aa7729df8a361b3a710c5e1e4617fb488f8d371d9a7da9f542943380de08ac5ad77ff06d861af0ee931
@@ -56,9 +56,9 @@ module CouchPillow
56
56
  #
57
57
  def save!
58
58
  whitelist!
59
- validate!
60
59
  sort!
61
60
  timestamp!
61
+ validate!
62
62
  to_save = @data.merge({
63
63
  :_type => self.class._type
64
64
  })
@@ -78,9 +78,9 @@ module CouchPillow
78
78
  #
79
79
  def update!
80
80
  whitelist!
81
- validate!
82
81
  sort!
83
82
  timestamp!
83
+ validate!
84
84
  to_save = @data.merge({
85
85
  :_type => self.class._type
86
86
  })
@@ -98,7 +98,6 @@ module CouchPillow
98
98
  end
99
99
  rename!
100
100
  whitelist!
101
- validate!
102
101
  end
103
102
 
104
103
 
@@ -1,5 +1,5 @@
1
1
  module CouchPillow
2
2
  GEM_NAME = "couchpillow"
3
3
  NAME = "CouchPillow"
4
- VERSION = "0.4.0"
4
+ VERSION = "0.4.1"
5
5
  end
@@ -88,6 +88,24 @@ class TestDocument < Minitest::Test
88
88
  end
89
89
 
90
90
 
91
+ def test_update_doesnt_trigger_validation
92
+ d = Class.new(Document) do
93
+ type 'test'
94
+ attribute(:a).type(Integer)
95
+ end.new({ a: 1, b: 2})
96
+ assert_equal 1, d[:a]
97
+ assert_equal 1, d.a
98
+ hash = {
99
+ 'a' => 'too',
100
+ }
101
+ d.update(hash)
102
+ assert_equal 'too', d.a
103
+ assert_raises CouchPillow::ValidationError do
104
+ assert d.save!
105
+ end
106
+ end
107
+
108
+
91
109
  def test_exclusion_other_keys
92
110
  d = Class.new(Document) do
93
111
  attribute :a
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: couchpillow
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Albert Tedja