Skip to content

Commit

Permalink
Merge 4515b18 into 5478ca4
Browse files Browse the repository at this point in the history
  • Loading branch information
andrykonchin committed Feb 21, 2020
2 parents 5478ca4 + 4515b18 commit dc0d654
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/dynamoid/persistence.rb
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ def persisted?
#
# @since 0.2.0
def save(_options = {})
self.class.create_table
self.class.create_table(sync: true)

if new_record?
run_callbacks(:create) do
Expand Down
2 changes: 2 additions & 0 deletions spec/dynamoid/persistence_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1531,6 +1531,8 @@ def log_message
it 'creates table if it does not exist' do
model = klass.new

expect(klass).to receive(:create_table).with(sync: true).and_call_original

expect { model.save }
.to change { tables_created.include?(klass.table_name) }
.from(false).to(true)
Expand Down

0 comments on commit dc0d654

Please sign in to comment.