Sha256: 5693d5396df201245b7f52488925f2e96bbb9953d3ad423493504fb4184af7ab

Contents?: true

Size: 597 Bytes

Versions: 11

Compression:

Stored size: 597 Bytes

Contents

require "test_helper"

class ObjectTest < Minitest::Test
  def test_creating_object_from_hash
    assert_equal "bar", Calendlyr::Object.new(foo: "bar").foo
  end

  def test_nested_hash
    assert_equal "foobar", Calendlyr::Object.new(foo: {bar: {baz: "foobar"}}, client: nil).foo.bar.baz
  end

  def test_nested_number
    assert_equal 1, Calendlyr::Object.new(foo: {bar: 1}, client: nil).foo.bar
  end

  def test_array
    object = Calendlyr::Object.new(foo: [{bar: :baz}], client: nil)
    assert_equal OpenStruct, object.foo.first.class
    assert_equal :baz, object.foo.first.bar
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
calendlyr-0.7.5 test/calendlyr/object_test.rb
calendlyr-0.7.4 test/calendlyr/object_test.rb
calendlyr-0.7.3 test/calendlyr/object_test.rb
calendlyr-0.7.2 test/calendlyr/object_test.rb
calendlyr-0.7.1 test/calendlyr/object_test.rb
calendlyr-0.7.0 test/calendlyr/object_test.rb
calendlyr-0.6.0 test/calendlyr/object_test.rb
calendlyr-0.5.0 test/calendlyr/object_test.rb
calendlyr-0.4.0 test/calendlyr/object_test.rb
calendlyr-0.3.6 test/calendlyr/object_test.rb
calendlyr-0.3.5 test/calendlyr/object_test.rb