Sha256: 5297924550e4ab3f2496ed203a5aeaf5d0846a1282158b2917d0b0cbef6b9191

Contents?: true

Size: 804 Bytes

Versions: 6

Compression:

Stored size: 804 Bytes

Contents

require 'test_helper'

class CassandraObject::IdentityTest < CassandraObject::TestCase
  test 'get id' do
    issue = Issue.create

    assert_equal issue.key.to_s, issue.id
  end

  test 'set id' do
    uuid = SimpleUUID::UUID.new.to_guid
    issue = Issue.create id: uuid

    assert_equal issue.key.to_s, uuid
  end

  test 'equality of new records' do
    assert_not_equal Issue.new, Issue.new
  end

  test 'equality' do
    first_issue = Issue.create
    second_issue = Issue.create

    assert_equal first_issue, first_issue
    assert_not_equal first_issue, second_issue
  end

  test 'parse_key' do
    assert_kind_of(
      CassandraObject::Identity::UUIDKeyFactory::UUID,
      Issue.parse_key('bb4cbbbc-b7c7-11e0-9ca2-732604ff41fe')
    )
    
    assert_nil Issue.parse_key('fail')
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
gotime-cassandra_object-2.8.5 test/unit/identity_test.rb
gotime-cassandra_object-2.8.4 test/identity_test.rb
gotime-cassandra_object-2.8.3 test/identity_test.rb
gotime-cassandra_object-2.8.2 test/identity_test.rb
gotime-cassandra_object-2.8.1 test/identity_test.rb
gotime-cassandra_object-2.8.0 test/identity_test.rb