Sha256: f808d9bffaae95baa85908e554fc307a8e853855d93445a1e9d34b68bdfbfe4a

Contents?: true

Size: 789 Bytes

Versions: 5

Compression:

Stored size: 789 Bytes

Contents

require 'test_helper'

class CassandraObject::InspectTest < CassandraObject::TestCase
  test 'attribute_for_inspect' do
    object = temp_object do
      string :long_string
      time :the_time
      integer :other
    end

    assert_equal "#{'x' * 51}...".inspect, object.new.attribute_for_inspect('x' * 100)
    assert_equal "2012-02-14 12:01:02".inspect, object.new.attribute_for_inspect(Time.new(2012, 02, 14, 12, 01, 02))
    assert_equal "\"foo\"", object.new.attribute_for_inspect('foo')
  end

  test 'inspect' do
    object = temp_object do
      string :description
      integer :price
    end.new(description: "yeah buddy", price: nil)

    assert_match /id/, object.inspect
    assert_match /description/, object.inspect
    assert_no_match /price/, object.inspect
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
gotime-cassandra_object-4.5.1 test/unit/inspect_test.rb
gotime-cassandra_object-4.5.0 test/unit/inspect_test.rb
gotime-cassandra_object-4.4.5 test/unit/inspect_test.rb
gotime-cassandra_object-4.4.4 test/unit/inspect_test.rb
gotime-cassandra_object-4.4.3 test/unit/inspect_test.rb