spec/integration/commands/delete_spec.rb in rom-sql-2.0.0.beta1 vs spec/integration/commands/delete_spec.rb in rom-sql-2.0.0.beta2

- old
+ new

@@ -22,41 +22,41 @@ end describe '#transaction' do it 'deletes in normal way if no error raised' do expect { - delete_user.transaction do + users.transaction do delete_user.by_name('Jade').call end }.to change { users.count }.by(-1) end it 'deletes nothing if error was raised' do expect { - delete_user.transaction do + users.transaction do |t| delete_user.by_name('Jade').call - raise ROM::SQL::Rollback + t.rollback! end }.to_not change { users.count } end end describe '#call' do it 'deletes all tuples in a restricted relation' do - result = user_commands.try { delete_user.by_name('Jade').call } + result = delete_user.by_name('Jade').call - expect(result.value).to eql(id: 3, name: 'Jade') + expect(result).to eql(id: 3, name: 'Jade') end it 're-raises database error' do command = delete_user.by_name('Jade') expect(command.relation).to receive(:delete).and_raise( Sequel::DatabaseError, 'totally wrong' ) expect { - user_commands.try { command.call } + command.call }.to raise_error(ROM::SQL::DatabaseError, /totally wrong/) end end describe '#execute' do