Sha256: aab6f74ef490a79e5720ddbee0dfbea8707e6bd1b659ef64301f1d59e2b8ec71

Contents?: true

Size: 1.36 KB

Versions: 16

Compression:

Stored size: 1.36 KB

Contents

require 'test_helper'

class CassandraObject::BaseTest < CassandraObject::TestCase
  class Son < CassandraObject::Base
  end

  class Grandson < Son
  end

  test 'base_class' do
    assert_equal Son, Son.base_class
    assert_equal Son, Grandson.base_class
  end

  test 'column family' do
    assert_equal 'CassandraObject::BaseTest::Sons', Son.column_family
    assert_equal 'CassandraObject::BaseTest::Sons', Grandson.column_family
  end

  test 'initialiaze' do
    issue = Issue.new
    
    assert issue.new_record?
    assert !issue.destroyed?
  end

  test 'dup' do
    issue = Issue.create description: 'foo'

    dup_issue = issue.dup

    assert dup_issue.new_record?
    assert_not_equal issue.id, dup_issue.id
    assert_nil dup_issue.created_at
    assert_nil dup_issue.updated_at
    assert_equal 'foo', issue.description
  end

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

  test 'equality' do
    first_issue = Issue.create description: 'poop'
    second_issue = Issue.create description: 'poop'

    assert_equal first_issue, first_issue
    assert_equal first_issue, Issue.find(first_issue.id)
    assert_not_equal first_issue, second_issue
  end

  test 'to_param' do
    issue = Issue.new
    assert_equal issue.id, issue.to_param
  end
  
  test 'hash' do
    issue = Issue.create
    assert_equal issue.id.hash, issue.hash
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

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