Sha256: efa3a668545b14b0d0917d15ba8ece1eecae6935f9b462fde025ccc8276f0abb

Contents?: true

Size: 1.3 KB

Versions: 70

Compression:

Stored size: 1.3 KB

Contents

require 'test_helper'

class CassandraObject::FinderMethodsTest < CassandraObject::TestCase
  test 'find' do
    persisted_issue = Issue.create
    found_issue = Issue.find(persisted_issue.id)

    assert_equal persisted_issue, found_issue
  end

  test 'find missing record' do
    assert_raise CassandraObject::InvalidKey do
      Issue.find('what')
    end
  end

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

    assert_equal [first_issue, second_issue].to_set, Issue.all.to_set
  end

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

    assert [first_issue, second_issue].include?(Issue.first)
  end

  test 'find_with_ids' do
    first_issue = Issue.create
    second_issue = Issue.create
    third_issue = Issue.create

    assert_equal [], Issue.find_with_ids([])
    assert_equal first_issue, Issue.find_with_ids(first_issue.key)
    assert_equal [first_issue, second_issue].to_set, Issue.find_with_ids(first_issue.key, second_issue.key).to_set
    assert_equal [first_issue, second_issue].to_set, Issue.find_with_ids([first_issue.key, second_issue.key]).to_set
  end

  # test 'find single id' do
  #   created_issue = Issue.create
  # 
  #   found_issue = Issue.find(created_issue.id)
  # 
  #   assert_equal created_issue, found_issue
  # end
end

Version data entries

70 entries across 70 versions & 1 rubygems

Version Path
sessionm-cassandra_object-4.0.13 test/finder_methods_test.rb
sessionm-cassandra_object-4.0.12 test/finder_methods_test.rb
sessionm-cassandra_object-4.0.11 test/finder_methods_test.rb
sessionm-cassandra_object-4.0.10 test/finder_methods_test.rb
sessionm-cassandra_object-4.0.9 test/finder_methods_test.rb
sessionm-cassandra_object-2.7.3 test/finder_methods_test.rb
sessionm-cassandra_object-2.7.2 test/finder_methods_test.rb
sessionm-cassandra_object-4.0.8 test/finder_methods_test.rb
sessionm-cassandra_object-4.0.7 test/finder_methods_test.rb
sessionm-cassandra_object-4.0.6 test/finder_methods_test.rb
sessionm-cassandra_object-4.0.5 test/finder_methods_test.rb
sessionm-cassandra_object-4.0.4 test/finder_methods_test.rb
sessionm-cassandra_object-4.0.3 test/finder_methods_test.rb
sessionm-cassandra_object-4.0.2 test/finder_methods_test.rb
sessionm-cassandra_object-4.0.1 test/finder_methods_test.rb
sessionm-cassandra_object-4.0.0 test/finder_methods_test.rb
sessionm-cassandra_object-2.7.1 test/finder_methods_test.rb
sessionm-cassandra_object-2.7.0 test/finder_methods_test.rb
sessionm-cassandra_object-2.6.1 test/finder_methods_test.rb
sessionm-cassandra_object-2.6.0 test/finder_methods_test.rb