Sha256: 07c5292afffdc468a3d0d93be9490669f3f5a5338037c8b44bdd6c0148f0eab3

Contents?: true

Size: 724 Bytes

Versions: 4

Compression:

Stored size: 724 Bytes

Contents

require "spec_helper"

describe GraphQL::Query::Arguments do
  let(:arguments) { GraphQL::Query::Arguments.new({ a: 1, b: 2, c: GraphQL::Query::Arguments.new({ d: 3, e: 4}) }) }

  it 'returns keys as strings' do
    assert_equal(['a', 'b', 'c'], arguments.keys)
  end

  it 'delegates values to values hash' do
    assert_equal([1, 2, {'d' => 3, 'e' => 4}], arguments.values)
  end

  it 'delegates each to values hash' do
    pairs = []
    arguments.each do |key, value|
      pairs << [key, value]
    end
    assert_equal([['a', 1], ['b', 2], ['c', {'d' => 3, 'e' => 4}]], pairs)
  end

  it 'returns original Ruby hash values with to_h' do
    assert_equal({ a: 1, b: 2, c: { d: 3, e: 4 } }, arguments.to_h)
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
graphql-0.12.1 spec/graphql/query/arguments_spec.rb
graphql-0.12.0 spec/graphql/query/arguments_spec.rb
graphql-0.11.1 spec/graphql/query/arguments_spec.rb
graphql-0.11.0 spec/graphql/query/arguments_spec.rb