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.32 test/finder_methods_test.rb
sessionm-cassandra_object-4.0.31 test/finder_methods_test.rb
sessionm-cassandra_object-4.0.30 test/finder_methods_test.rb
sessionm-cassandra_object-4.0.29 test/finder_methods_test.rb
sessionm-cassandra_object-4.0.28 test/finder_methods_test.rb
sessionm-cassandra_object-4.0.27 test/finder_methods_test.rb
sessionm-cassandra_object-4.0.26 test/finder_methods_test.rb
sessionm-cassandra_object-4.0.25 test/finder_methods_test.rb
sessionm-cassandra_object-4.0.24 test/finder_methods_test.rb
sessionm-cassandra_object-4.0.23 test/finder_methods_test.rb
sessionm-cassandra_object-4.0.22 test/finder_methods_test.rb
sessionm-cassandra_object-4.0.21 test/finder_methods_test.rb
sessionm-cassandra_object-4.0.20 test/finder_methods_test.rb
sessionm-cassandra_object-2.7.5 test/finder_methods_test.rb
sessionm-cassandra_object-2.7.4 test/finder_methods_test.rb
sessionm-cassandra_object-4.0.18 test/finder_methods_test.rb
sessionm-cassandra_object-4.0.17 test/finder_methods_test.rb
sessionm-cassandra_object-4.0.16 test/finder_methods_test.rb
sessionm-cassandra_object-4.0.15 test/finder_methods_test.rb
sessionm-cassandra_object-4.0.14 test/finder_methods_test.rb