Skip to content

Commit

Permalink
Update specs
Browse files Browse the repository at this point in the history
  • Loading branch information
mullermp committed Sep 28, 2023
1 parent db2b4e7 commit 90b94f6
Showing 1 changed file with 9 additions and 20 deletions.
29 changes: 9 additions & 20 deletions spec/aws-record/record/item_operations_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ module Record
)
end

it 'passes through default api options' do
it 'passes through options to #update_item and #put_item' do
klass.configure_client(client: stub_client)
item = klass.new
item.id = 1
Expand All @@ -85,12 +85,12 @@ module Record
item.body = 'Goodbye!'
item.save!(table_name: 'notused', return_values: 'UPDATED_NEW')

expect(api_requests).to include(
expect(api_requests).to match [
hash_including(table_name: 'TestTable', return_values: 'ALL_OLD'),
hash_including(table_name: 'TestTable', return_values: 'UPDATED_OLD'),
hash_including(table_name: 'TestTable', return_values: 'ALL_NEW'),
hash_including(table_name: 'TestTable', return_values: 'UPDATED_NEW')
)
]
end

it 'raises an error when you try to save! without setting keys' do
Expand Down Expand Up @@ -201,7 +201,7 @@ module Record
)
end

it 'passes through default api options' do
it 'passes through options to #update_item and #put_item' do
klass.configure_client(client: stub_client)
item = klass.new
item.id = 1
Expand All @@ -218,12 +218,12 @@ module Record
item.body = 'Goodbye!'
item.save(table_name: 'notused', return_values: 'UPDATED_NEW')

expect(api_requests).to include(
expect(api_requests).to match [
hash_including(table_name: 'TestTable', return_values: 'ALL_OLD'),
hash_including(table_name: 'TestTable', return_values: 'UPDATED_OLD'),
hash_including(table_name: 'TestTable', return_values: 'ALL_NEW'),
hash_including(table_name: 'TestTable', return_values: 'UPDATED_NEW')
)
]
end

it 'raises an exception when the conditional check fails' do
Expand Down Expand Up @@ -414,18 +414,7 @@ module Record
consistent_read: true
}
klass.find_with_opts(find_opts)
expect(api_requests).to eq(
[
{
table_name: 'TestTable',
key: {
'id' => { n: '5' },
'MyDate' => { s: '2015-12-15' }
},
consistent_read: true
}
]
)
expect(api_requests).to match([hash_including(consistent_read: true)])
end
end

Expand Down Expand Up @@ -565,12 +554,12 @@ module Record
)
end

it 'passes through api options' do
it 'passes through options to #delete_item' do
klass.configure_client(client: stub_client)
item = klass.new
item.id = 3
item.date = '2015-12-17'
item.delete!(table_name: 'donotuse', return_values: 'ALL_OLD')
item.delete!(table_name: 'notused', return_values: 'ALL_OLD')
expect(api_requests).to include(
hash_including(table_name: 'TestTable', return_values: 'ALL_OLD')
)
Expand Down

0 comments on commit 90b94f6

Please sign in to comment.