Sha256: 1328d9c9bb063bc763bdfe6c828f1274874895fe95393bbcdbb93fbc6ae26f75

Contents?: true

Size: 776 Bytes

Versions: 51

Compression:

Stored size: 776 Bytes

Contents

# frozen_string_literal: true
require "spec_helper"
require "generators/graphql/enum_generator"

class GraphQLGeneratorsEnumGeneratorTest < BaseGeneratorTest
  tests Graphql::Generators::EnumGenerator

  test "it generate enums with values" do
    expected_content = <<-RUBY
Types::FamilyType = GraphQL::EnumType.define do
  name "Family"
  value "NIGHTSHADE"
  value "BRASSICA", value: Family::COLE
  value "UMBELLIFER", value: :umbellifer
  value "LEGUME", value: "bean & friends"
  value "CURCURBITS", value: 5
end
RUBY

    run_generator(["Family",
      "NIGHTSHADE",
      "BRASSICA:Family::COLE",
      "UMBELLIFER::umbellifer",
      'LEGUME:"bean & friends"',
      "CURCURBITS:5"
    ])
    assert_file "app/graphql/types/family_type.rb", expected_content
  end
end

Version data entries

51 entries across 51 versions & 1 rubygems

Version Path
graphql-1.8.1 spec/generators/graphql/enum_generator_spec.rb
graphql-1.8.0 spec/generators/graphql/enum_generator_spec.rb
graphql-1.8.0.pre11 spec/generators/graphql/enum_generator_spec.rb
graphql-1.8.0.pre10 spec/generators/graphql/enum_generator_spec.rb
graphql-1.7.14 spec/generators/graphql/enum_generator_spec.rb
graphql-1.8.0.pre9 spec/generators/graphql/enum_generator_spec.rb
graphql-1.8.0.pre8 spec/generators/graphql/enum_generator_spec.rb
graphql-1.7.13 spec/generators/graphql/enum_generator_spec.rb
graphql-1.8.0.pre7 spec/generators/graphql/enum_generator_spec.rb
graphql-1.7.12 spec/generators/graphql/enum_generator_spec.rb
graphql-1.7.11 spec/generators/graphql/enum_generator_spec.rb
graphql-1.7.10 spec/generators/graphql/enum_generator_spec.rb
graphql-1.8.0.pre6 spec/generators/graphql/enum_generator_spec.rb
graphql-1.8.0.pre5 spec/generators/graphql/enum_generator_spec.rb
graphql-1.7.9 spec/generators/graphql/enum_generator_spec.rb
graphql-1.8.0.pre4 spec/generators/graphql/enum_generator_spec.rb
graphql-1.8.0.pre3 spec/generators/graphql/enum_generator_spec.rb
graphql-1.7.8 spec/generators/graphql/enum_generator_spec.rb
graphql-1.8.0.pre2 spec/generators/graphql/enum_generator_spec.rb
graphql-1.7.7 spec/generators/graphql/enum_generator_spec.rb