Sha256: 1d5c10a47214f0e1e6d11d49c18399adf4dae2fdc00e5ad4c0e411fb229ab80c

Contents?: true

Size: 545 Bytes

Versions: 9

Compression:

Stored size: 545 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) {
    types = [type_1, type_2]
    GraphQL::UnionType.define {
      name("MyUnion")
      description("Some items")
      possible_types(types)
    }
  }
  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

9 entries across 9 versions & 1 rubygems

Version Path
graphql-0.9.3 spec/graphql/union_type_spec.rb
graphql-0.9.2 spec/graphql/union_type_spec.rb
graphql-0.8.1 spec/graphql/union_type_spec.rb
graphql-0.8.0 spec/graphql/union_type_spec.rb
graphql-0.7.1 spec/graphql/union_type_spec.rb
graphql-0.7.0 spec/graphql/union_type_spec.rb
graphql-0.6.2 spec/graphql/union_type_spec.rb
graphql-0.6.1 spec/graphql/union_type_spec.rb
graphql-0.6.0 spec/graphql/union_type_spec.rb