mince_dynamo_db 1.3.0 → 1.3.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -244,7 +244,7 @@ module MinceDynamoDb # :nodoc:
244
244
 
245
245
  # Takes a DynamoDB item and returns the attributes of that item as a hash
246
246
  def to_hash(item)
247
- item.attributes.to_h if item
247
+ item.attributes if item
248
248
  end
249
249
 
250
250
  # Takes an array of DynamoDB items and returns the attributes of each item as a hash.
@@ -1,3 +1,3 @@
1
1
  module MinceDynamoDb
2
- VERSION = "1.3.0"
2
+ VERSION = "1.3.1"
3
3
  end
@@ -14,8 +14,7 @@ describe MinceDynamoDb::DataStore do
14
14
  let(:sanitized_time) { mock 'sanitized time' }
15
15
  let(:sanitized_id) { mock 'sanitized id' }
16
16
  let(:return_data) { mock 'return data', attributes: attributes }
17
- let(:attributes) { mock 'attributes', to_h: hash }
18
- let(:hash) { mock 'hash' }
17
+ let(:attributes) { mock 'attributes' }
19
18
  let(:items) { mock 'items' }
20
19
 
21
20
  before do
@@ -55,12 +54,11 @@ describe MinceDynamoDb::DataStore do
55
54
  end
56
55
 
57
56
  it 'can read from the collection' do
58
- item_hash = mock 'hash of attributes for an item'
59
- item_attributes = mock 'attributes for an item', to_h: item_hash
57
+ item_attributes = mock 'attributes for an item'
60
58
  item = mock 'item', attributes: item_attributes
61
59
  collection.stub(items: [item])
62
60
 
63
- subject.find_all(collection_name).should == [item_hash]
61
+ subject.find_all(collection_name).should == [item_attributes]
64
62
  end
65
63
 
66
64
  it 'can replace a record' do
@@ -75,7 +73,7 @@ describe MinceDynamoDb::DataStore do
75
73
 
76
74
  items.should_receive(:where).with(field => value).and_return([return_data])
77
75
 
78
- subject.find(collection_name, field, value).should == hash
76
+ subject.find(collection_name, field, value).should == attributes
79
77
  end
80
78
 
81
79
  it 'can delete a record that matches a criteria' do
@@ -104,13 +102,13 @@ describe MinceDynamoDb::DataStore do
104
102
  it 'can get all records of a specific key value' do
105
103
  items.should_receive(:where).with("key" => "value").and_return([return_data])
106
104
 
107
- subject.get_all_for_key_with_value(collection_name, "key", "value").should == [hash]
105
+ subject.get_all_for_key_with_value(collection_name, "key", "value").should == [attributes]
108
106
  end
109
107
 
110
108
  it 'can get a record of a specific key value' do
111
109
  items.should_receive(:where).with({"key" => "value"}).and_return([return_data])
112
110
 
113
- subject.get_for_key_with_value(collection_name, "key", "value").should == hash
111
+ subject.get_for_key_with_value(collection_name, "key", "value").should == attributes
114
112
  end
115
113
 
116
114
  it 'can get all records where a value includes any of a set of values' do
@@ -118,7 +116,7 @@ describe MinceDynamoDb::DataStore do
118
116
  items.should_receive(:where).with(:key1).and_return(filter)
119
117
  filter.should_receive(:in).with([1,2,4]).and_return([return_data])
120
118
 
121
- subject.containing_any(collection_name, "key1", [1,2,4]).should == [hash]
119
+ subject.containing_any(collection_name, "key1", [1,2,4]).should == [attributes]
122
120
  end
123
121
 
124
122
  it 'can get all records where the array includes a value' do
@@ -126,7 +124,7 @@ describe MinceDynamoDb::DataStore do
126
124
  items.should_receive(:where).with(:key).and_return(filter)
127
125
  filter.should_receive(:contains).with('value').and_return([return_data])
128
126
 
129
- subject.array_contains(collection_name, "key", "value").should == [hash]
127
+ subject.array_contains(collection_name, "key", "value").should == [attributes]
130
128
  end
131
129
 
132
130
  it 'can push a value to an array for a specific record' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mince_dynamo_db
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.3.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: