Sha256: 664b3dedfa453563662eac7f3e34b2c9b00d1817df8e6a4c34662047a6a36457

Contents?: true

Size: 867 Bytes

Versions: 35

Compression:

Stored size: 867 Bytes

Contents

require File.expand_path('../../../test_helper', __FILE__)

module Maestrano
  module API
    class ObjectTest < Test::Unit::TestCase
      should "implement #respond_to correctly" do
        obj = Maestrano::API::Object.construct_from({ :id => 1, :foo => 'bar' })
        assert obj.respond_to?(:id)
        assert obj.respond_to?(:foo)
        assert !obj.respond_to?(:baz)
      end

      should "marshal a maestrano object correctly" do
        date = Time.now.utc
        obj = Maestrano::API::Object.construct_from({ 
          id: 1, 
          name: 'Maestrano',
          some_date: date.iso8601
        }, 'apikey')
        m = Marshal.load(Marshal.dump(obj))
        assert_equal 1, m.id
        assert_equal 'Maestrano', m.name
        assert_equal 'apikey', m.api_token
        assert_equal date.iso8601, m.some_date.iso8601
      end
    end
  end
end

Version data entries

35 entries across 35 versions & 2 rubygems

Version Path
maestrano-1.0.6 test/maestrano/api/object_test.rb
maestrano-1.0.5 test/maestrano/api/object_test.rb
maestrano-1.0.4 test/maestrano/api/object_test.rb
maestrano-1.0.3 test/maestrano/api/object_test.rb
maestrano-1.0.2 test/maestrano/api/object_test.rb
maestrano-1.0.1 test/maestrano/api/object_test.rb
maestrano-1.0.0 test/maestrano/api/object_test.rb
maestrano-1.0.0.pre.RC9 test/maestrano/api/object_test.rb
maestrano-1.0.0.pre.RC8 test/maestrano/api/object_test.rb
maestrano-1.0.0.pre.RC7 test/maestrano/api/object_test.rb
maestrano-1.0.0.pre.RC6 test/maestrano/api/object_test.rb
maestrano-1.0.0.pre.RC5 test/maestrano/api/object_test.rb
maestrano-1.0.0.pre.RC4 test/maestrano/api/object_test.rb
maestrano-1.0.0.pre.RC3 test/maestrano/api/object_test.rb
maestrano-1.0.0.pre.RC2 test/maestrano/api/object_test.rb
maestrano-1.0.0.pre.RC1 test/maestrano/api/object_test.rb
maestrano-0.12.5 test/maestrano/api/object_test.rb
maestrano-0.12.4 test/maestrano/api/object_test.rb
maestrano-0.12.3 test/maestrano/api/object_test.rb
maestrano-0.12.2 test/maestrano/api/object_test.rb