Sha256: 21cf15067454f148b5b4da3c50a471287f92f72d35c890192a9dfe6370fecf15

Contents?: true

Size: 1.07 KB

Versions: 24

Compression:

Stored size: 1.07 KB

Contents

require 'test_helper'

class DirtyTest < CassandraObjectTestCase
  def setup
    super

    @customer = Customer.create :first_name    => "Michael",
                                :last_name     => "Koziarski",
                                :date_of_birth => Date.parse("1980/08/15")
    @customer_key = @customer.key
    assert @customer.valid?, @customer.errors.full_messages.to_sentence
  end

  test "a new object can be retrieved by key" do
    assert_equal "Michael", @customer.first_name
    assert !@customer.changed?
    assert_equal [], @customer.changed
    assert_equal({}, @customer.changes)

    @customer.first_name = "Josh"
    assert_equal "Josh", @customer.first_name

    assert @customer.changed?
    assert_equal ["first_name"], @customer.changed
    assert_equal({"first_name" => ["Michael", "Josh"]}, @customer.changes)

    assert @customer.first_name_changed?
    assert_equal ["Michael", "Josh"], @customer.first_name_change
    assert_equal "Michael", @customer.first_name_was

    @customer.reset_first_name!
    assert_equal "Michael", @customer.first_name
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
gotime-cassandra_object-2.2.0 test-old/dirty_test.rb
gotime-cassandra_object-2.1.2 test-old/dirty_test.rb
gotime-cassandra_object-2.1.1 test-old/dirty_test.rb
gotime-cassandra_object-2.1.0 test-old/dirty_test.rb
gotime-cassandra_object-2.0.0 test-old/dirty_test.rb
gotime-cassandra_object-0.9.1 test/dirty_test.rb
gotime-cassandra_object-0.9.0 test/dirty_test.rb
gotime-cassandra_object-0.8.7 test/dirty_test.rb
gotime-cassandra_object-0.8.6 test/dirty_test.rb
gotime-cassandra_object-0.8.5 test/dirty_test.rb
gotime-cassandra_object-0.8.4 test/dirty_test.rb
gotime-cassandra_object-0.8.3 test/dirty_test.rb
gotime-cassandra_object-0.8.2 test/dirty_test.rb
gotime-cassandra_object-0.8.1 test/dirty_test.rb
gotime-cassandra_object-0.8.0 test/dirty_test.rb
gotime-cassandra_object-0.7.8 test/dirty_test.rb
gotime-cassandra_object-0.7.7 test/dirty_test.rb
gotime-cassandra_object-0.7.6 test/dirty_test.rb
gotime-cassandra_object-0.7.5 test/dirty_test.rb
gotime-cassandra_object-0.7.4 test/dirty_test.rb