Sha256: d7b5eba0473ca580fa37c8477a182556e3036feb6f870a634f4681b704dbacf6

Contents?: true

Size: 721 Bytes

Versions: 20

Compression:

Stored size: 721 Bytes

Contents

require 'test_helper'

class CassandraObject::SavepointsTest < CassandraObject::TestCase
  test 'rollback create' do
    Issue.savepoint do
      issue = Issue.create description: 'foo'
      raise 'lol'
    end
    
    assert_nil Issue.first
  end
  
  test 'rollback update' do
    issue = Issue.create description: 'foo'
  
    Issue.savepoint do
      issue.update_attributes description: 'bar'
      raise 'lol'
    end
    
    issue = Issue.find issue.id
    assert_equal 'foo', issue.description
  end

  test 'rollback destroy' do
    issue = Issue.create description: 'foo'
  
    Issue.savepoint do
      issue.destroy
      raise 'lol'
    end
    
    assert_nothing_raised { Issue.find issue.id }
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
gotime-cassandra_object-4.5.1 test/unit/savepoints_test.rb
gotime-cassandra_object-4.5.0 test/unit/savepoints_test.rb
gotime-cassandra_object-4.4.5 test/unit/savepoints_test.rb
gotime-cassandra_object-4.4.4 test/unit/savepoints_test.rb
gotime-cassandra_object-4.4.3 test/unit/savepoints_test.rb
gotime-cassandra_object-4.4.0 test/unit/savepoints_test.rb
gotime-cassandra_object-4.3.2 test/unit/savepoints_test.rb
gotime-cassandra_object-4.3.1 test/unit/savepoints_test.rb
gotime-cassandra_object-4.3.0 test/unit/savepoints_test.rb
gotime-cassandra_object-4.2.2 test/unit/savepoints_test.rb
gotime-cassandra_object-4.2.0 test/unit/savepoints_test.rb
gotime-cassandra_object-4.1.0 test/unit/savepoints_test.rb
gotime-cassandra_object-4.0.2 test/unit/savepoints_test.rb
gotime-cassandra_object-4.0.1 test/unit/savepoints_test.rb
gotime-cassandra_object-4.0.0 test/unit/savepoints_test.rb
gotime-cassandra_object-3.0.5 test/unit/savepoints_test.rb
gotime-cassandra_object-3.0.4 test/unit/savepoints_test.rb
gotime-cassandra_object-3.0.3 test/unit/savepoints_test.rb
gotime-cassandra_object-3.0.2 test/unit/savepoints_test.rb
gotime-cassandra_object-3.0.1 test/unit/savepoints_test.rb