Sha256: 33012e334c8b54e4f27e70ffb3b8b2ce42b8bf05c8b531252e7abfc823deddf8

Contents?: true

Size: 460 Bytes

Versions: 2

Compression:

Stored size: 460 Bytes

Contents

require 'spec_helper'

describe GraphQL::UnionType do
  let(:type_1) { OpenStruct.new(kind: GraphQL::TypeKinds::OBJECT)}
  let(:type_2) { OpenStruct.new(kind: GraphQL::TypeKinds::OBJECT)}
  let(:union) { GraphQL::UnionType.new("MyUnion", "Some items", [type_1, type_2]) }
  it 'has a name' do
    assert_equal("MyUnion", union.name)
  end

  it 'infers type from an object' do
    assert_equal(CheeseType, DairyProductUnion.resolve_type(CHEESES[1]))
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
graphql-0.5.0 spec/graph_ql/union_type_spec.rb
graphql-0.4.0 spec/graph_ql/union_type_spec.rb