Sha256: e082184c26817fd308690b176c92758f895511bd4219ff9a96c7749263d7cc77

Contents?: true

Size: 679 Bytes

Versions: 8

Compression:

Stored size: 679 Bytes

Contents

require 'test_helper'

class CassandraObject::IdentityTest < CassandraObject::TestCase
  test 'primary_key' do
    assert_equal 'id', Issue.primary_key
  end

  test 'get key' do
    issue = Issue.new

    assert_not_nil issue.key
  end

  test 'get id' do
    issue = Issue.new

    assert_equal issue.key.to_s, issue.id
  end

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

    assert_equal issue.key.to_s, uuid
  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

8 entries across 8 versions & 1 rubygems

Version Path
gotime-cassandra_object-2.11.4 test/unit/identity_test.rb
gotime-cassandra_object-2.11.3 test/unit/identity_test.rb
gotime-cassandra_object-2.11.2 test/unit/identity_test.rb
gotime-cassandra_object-2.11.1 test/unit/identity_test.rb
gotime-cassandra_object-2.11.0 test/unit/identity_test.rb
gotime-cassandra_object-2.10.11 test/unit/identity_test.rb
gotime-cassandra_object-2.10.10 test/unit/identity_test.rb
gotime-cassandra_object-2.10.9 test/unit/identity_test.rb