spec/generators/graphql/install_generator_spec.rb in graphql-1.8.6 vs spec/generators/graphql/install_generator_spec.rb in graphql-1.8.7
- old
+ new
@@ -46,19 +46,21 @@
RUBY
assert_file "app/graphql/dummy_schema.rb", expected_schema
expected_query_type = <<-RUBY
-class Types::QueryType < Types::BaseObject
- # Add root-level fields here.
- # They will be entry points for queries on your schema.
+module Types
+ class QueryType < Types::BaseObject
+ # Add root-level fields here.
+ # They will be entry points for queries on your schema.
- # TODO: remove me
- field :test_field, String, null: false,
- description: \"An example field added by the generator\"
- def test_field
- \"Hello World!\"
+ # TODO: remove me
+ field :test_field, String, null: false,
+ description: \"An example field added by the generator\"
+ def test_field
+ \"Hello World!\"
+ end
end
end
RUBY
assert_file "app/graphql/types/query_type.rb", expected_query_type
@@ -78,21 +80,23 @@
assert_file "Gemfile" do |contents|
assert_match %r{gem ('|")graphql-batch('|")}, contents
end
expected_query_type = <<-RUBY
-class Types::QueryType < Types::BaseObject
- # Add root-level fields here.
- # They will be entry points for queries on your schema.
+module Types
+ class QueryType < Types::BaseObject
+ # Add root-level fields here.
+ # They will be entry points for queries on your schema.
- # TODO: remove me
- field :test_field, String, null: false,
- description: \"An example field added by the generator\"
- def test_field
- \"Hello World!\"
- end
+ # TODO: remove me
+ field :test_field, String, null: false,
+ description: \"An example field added by the generator\"
+ def test_field
+ \"Hello World!\"
+ end
- field :node, field: GraphQL::Relay::Node.field
+ field :node, field: GraphQL::Relay::Node.field
+ end
end
RUBY
assert_file "app/graphql/types/query_type.rb", expected_query_type
assert_file "app/graphql/dummy_schema.rb", EXPECTED_RELAY_BATCH_SCHEMA