dynamini 2.2.4 → 2.2.5

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: 2142757afc1e24fc1ba5e2b4a94ce6b2c78233d1
4
- data.tar.gz: d4d7db8f6d7cca4b4ce9db53c9cb96b654d5e8e8
3
+ metadata.gz: cc2cb03535d576707c7d063479495420f147402c
4
+ data.tar.gz: 9a13209c5dd606f18be36a0a6b8178cee4a95309
5
5
  SHA512:
6
- metadata.gz: f0b6a462b83cf6fbedf57b9461609c93c0365ec464c7375efe52d771b344aa527b01e7987c175dcec1f211b25f99de8e97301270d99cae415d6da685afbc9ade
7
- data.tar.gz: 554c023d9ff949d396087def3f109954a369de499fd4ed1fb7b4a2f4537ac4d034dda782342337b818e11ded424ae022710406464c8496d79728ebc5ff23323c
6
+ metadata.gz: ed8549da709ccd8347fa152729a07ad9889ae33afbdfaa7e8d0162d791a869bbe660c78185eb332eb70ec3c784deda8d0a2d4559848ba24e742b7bb53dbfdabb
7
+ data.tar.gz: 054b7037256a8e9c8af8c7e8fbe12de5b6f99df929ace57361c731ec07c622bfe49bded36cf43db93b629bd18896455a7ab520bf7711841fe1def54c1cdef51d
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dynamini (2.2.4)
4
+ dynamini (2.2.5)
5
5
  activemodel (>= 3, < 5.0)
6
6
  aws-sdk (~> 2)
7
7
 
@@ -17,12 +17,12 @@ GEM
17
17
  minitest (~> 5.1)
18
18
  thread_safe (~> 0.3, >= 0.3.4)
19
19
  tzinfo (~> 1.1)
20
- aws-sdk (2.2.14)
21
- aws-sdk-resources (= 2.2.14)
22
- aws-sdk-core (2.2.14)
20
+ aws-sdk (2.2.22)
21
+ aws-sdk-resources (= 2.2.22)
22
+ aws-sdk-core (2.2.22)
23
23
  jmespath (~> 1.0)
24
- aws-sdk-resources (2.2.14)
25
- aws-sdk-core (= 2.2.14)
24
+ aws-sdk-resources (2.2.22)
25
+ aws-sdk-core (= 2.2.22)
26
26
  builder (3.2.2)
27
27
  coderay (1.1.0)
28
28
  diff-lcs (1.2.5)
@@ -99,6 +99,3 @@ DEPENDENCIES
99
99
  guard-shell
100
100
  pry (~> 0)
101
101
  rspec (~> 3)
102
-
103
- BUNDLED WITH
104
- 1.11.2
data/dynamini.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'dynamini'
3
- s.version = '2.2.4'
3
+ s.version = '2.2.5'
4
4
  s.summary = 'DynamoDB interface'
5
5
  s.description = 'Lightweight DynamoDB interface gem designed as
6
6
  a drop-in replacement for ActiveRecord.
data/lib/dynamini/base.rb CHANGED
@@ -17,7 +17,6 @@ module Dynamini
17
17
  include Dynamini::Increment
18
18
  include Dynamini::TypeHandler
19
19
 
20
-
21
20
  attr_reader :attributes
22
21
  class_attribute :handles
23
22
 
@@ -175,7 +174,7 @@ module Dynamini
175
174
  def attribute_updates
176
175
  changes.reduce({}) do |updates, (key, value)|
177
176
  current_value = value[1]
178
- updates[key] = {value: current_value, action: 'PUT'} unless current_value.blank?
177
+ updates[key] = { value: current_value, action: 'PUT' }
179
178
  updates
180
179
  end
181
180
  end
@@ -200,6 +200,24 @@ describe Dynamini::Base do
200
200
  model.save
201
201
  end
202
202
  end
203
+
204
+ context 'when an empty array is submitted' do
205
+ it 'should submit the array' do
206
+ expect(model.class.client).to receive(:update_item).with(
207
+ table_name: 'bases',
208
+ key: {id: model_attributes[:id]},
209
+ attribute_updates: hash_including(
210
+ "foo" => {
211
+ value: [],
212
+ action: 'PUT'
213
+ }
214
+ )
215
+ )
216
+ model.foo = []
217
+ model.bar = 4
218
+ model.save
219
+ end
220
+ end
203
221
  end
204
222
 
205
223
  context 'when failing validation' do
@@ -459,6 +477,19 @@ describe Dynamini::Base do
459
477
  expect(model.foo).to eq('bar')
460
478
  end
461
479
  end
480
+
481
+ context 'arrays' do
482
+ it 'should write to the attribute and switch type freely' do
483
+ model.foo = ['bar', 'baz']
484
+ expect(model.foo).to eq(['bar', 'baz'])
485
+ model.foo = ['quux']
486
+ expect(model.foo).to eq(['quux'])
487
+ model.foo = 'zort'
488
+ expect(model.foo).to eq('zort')
489
+ model.foo = []
490
+ expect(model.foo).to eq([])
491
+ end
492
+ end
462
493
  end
463
494
 
464
495
  describe '#key' do
@@ -16,7 +16,7 @@ describe Dynamini::TypeHandler do
16
16
  object = HandledClass.new
17
17
  expect(object.price).to eq(9)
18
18
  end
19
- it 'should return an array with formated item if handled' do
19
+ it 'should return an array with formatted items if handled' do
20
20
  object = HandledClass.new(price: ["1", "2"])
21
21
  expect(object.price).to eq([1, 2])
22
22
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dynamini
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.4
4
+ version: 2.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Greg Ward
@@ -15,7 +15,7 @@ authors:
15
15
  autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
- date: 2016-03-11 00:00:00.000000000 Z
18
+ date: 2016-03-23 00:00:00.000000000 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: activemodel