Sha256: 2ce10f9c0881e609575765183430ac803e5474ac5061c6f0bea38f2d4859257e

Contents?: true

Size: 780 Bytes

Versions: 26

Compression:

Stored size: 780 Bytes

Contents

require 'test_helper'

class Superstore::InspectTest < Superstore::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

26 entries across 26 versions & 1 rubygems

Version Path
superstore-2.3.0 test/unit/inspect_test.rb
superstore-2.2.0 test/unit/inspect_test.rb
superstore-2.1.3 test/unit/inspect_test.rb
superstore-2.1.2 test/unit/inspect_test.rb
superstore-2.1.1 test/unit/inspect_test.rb
superstore-2.1.0 test/unit/inspect_test.rb
superstore-2.0.1 test/unit/inspect_test.rb
superstore-2.0.0 test/unit/inspect_test.rb
superstore-1.2.0 test/unit/inspect_test.rb
superstore-1.1.4 test/unit/inspect_test.rb
superstore-1.1.3 test/unit/inspect_test.rb
superstore-1.1.2 test/unit/inspect_test.rb
superstore-1.1.1 test/unit/inspect_test.rb
superstore-1.1.0 test/unit/inspect_test.rb
superstore-1.0.12 test/unit/inspect_test.rb
superstore-1.0.11 test/unit/inspect_test.rb
superstore-1.0.10 test/unit/inspect_test.rb
superstore-1.0.9 test/unit/inspect_test.rb
superstore-1.0.8 test/unit/inspect_test.rb
superstore-1.0.7 test/unit/inspect_test.rb