Sha256: 193b543572c383486a9ba97510e6313613e66d998962e485f3c2b4059229717a

Contents?: true

Size: 1.04 KB

Versions: 6

Compression:

Stored size: 1.04 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 '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_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

6 entries across 6 versions & 1 rubygems

Version Path
gotime-cassandra_object-2.13.0 test/unit/base_test.rb
gotime-cassandra_object-2.12.5 test/unit/base_test.rb
gotime-cassandra_object-2.12.4 test/unit/base_test.rb
gotime-cassandra_object-2.12.3 test/unit/base_test.rb
gotime-cassandra_object-2.12.2 test/unit/base_test.rb
gotime-cassandra_object-2.12.1 test/unit/base_test.rb