Sha256: 4f7ffcacb4a555948084631bdcb2385bb9fc4f5b2e0b993c834468fa2af170fb

Contents?: true

Size: 917 Bytes

Versions: 24

Compression:

Stored size: 917 Bytes

Contents

class CassandraObjectTestCase < ActiveSupport::TestCase
  def teardown
    CassandraObject::Base.connection.clear_keyspace!
  end

  def mock_invoice
    Invoice.create :number=>Time.now.to_i*(rand(5)), :total=>Time.now.to_f
  end

  def connection
    CassandraObject::Base.connection
  end
  
  def assert_ordered(expected_object_order, actual_order, to_s_before_comparing = true)
    # don't use map! so we don't go changing user's arguments
    if to_s_before_comparing
      expected_object_order = expected_object_order.map(&:to_s) 
      actual_order = actual_order.map(&:to_s)
    end
    
    assert_equal Set.new(expected_object_order), Set.new(actual_order), "Collections weren't equal"
    actual_indexes = actual_order.map do |e|
      expected_object_order.index(e)
    end
    assert_equal expected_object_order, actual_order, "Collection was ordered incorrectly: #{actual_indexes.inspect}"
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
gotime-cassandra_object-2.2.0 test-old/test_case.rb
gotime-cassandra_object-2.1.2 test-old/test_case.rb
gotime-cassandra_object-2.1.1 test-old/test_case.rb
gotime-cassandra_object-2.1.0 test-old/test_case.rb
gotime-cassandra_object-2.0.0 test-old/test_case.rb
gotime-cassandra_object-0.9.1 test/test_case.rb
gotime-cassandra_object-0.9.0 test/test_case.rb
gotime-cassandra_object-0.8.7 test/test_case.rb
gotime-cassandra_object-0.8.6 test/test_case.rb
gotime-cassandra_object-0.8.5 test/test_case.rb
gotime-cassandra_object-0.8.4 test/test_case.rb
gotime-cassandra_object-0.8.3 test/test_case.rb
gotime-cassandra_object-0.8.2 test/test_case.rb
gotime-cassandra_object-0.8.1 test/test_case.rb
gotime-cassandra_object-0.8.0 test/test_case.rb
gotime-cassandra_object-0.7.8 test/test_case.rb
gotime-cassandra_object-0.7.7 test/test_case.rb
gotime-cassandra_object-0.7.6 test/test_case.rb
gotime-cassandra_object-0.7.5 test/test_case.rb
gotime-cassandra_object-0.7.4 test/test_case.rb