Skip to content

Commit

Permalink
add a test for adding a transaction
Browse files Browse the repository at this point in the history
  • Loading branch information
layer-1 committed Aug 24, 2020
1 parent 6368569 commit 3f1353a
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions spec/dynamoid/persistence_spec.rb
Expand Up @@ -1306,7 +1306,7 @@ def log_message
obj = document_class.create(title: 'New Document')

expect {
document_class.update_fields(obj.id, { title: 'New title', publisher: 'New publisher' } )
document_class.update_fields(obj.id, { title: 'New title', publisher: 'New publisher' })
}.to raise_error Dynamoid::Errors::UnknownAttribute
end
end
Expand Down Expand Up @@ -1491,7 +1491,7 @@ def log_message
obj = document_class.create(title: 'New Document')

expect {
document_class.upsert(obj.id, { title: 'New title', publisher: 'New publisher' } )
document_class.upsert(obj.id, { title: 'New title', publisher: 'New publisher' })
}.to raise_error Dynamoid::Errors::UnknownAttribute
end
end
Expand Down Expand Up @@ -2594,6 +2594,20 @@ def log_message
end
end

describe '.transact' do
before do
Address.create_table
end

it 'process transaction' do
expect do
Address.transact([{
put: { city: 'Chicago' }
}, { put: { city: 'New York' } }])
end.to change { Address.count }.by(2)
end
end

describe '.import' do
before do
Address.create_table
Expand Down

0 comments on commit 3f1353a

Please sign in to comment.