spec/generators/graphql/object_generator_spec.rb in graphql-1.8.6 vs spec/generators/graphql/object_generator_spec.rb in graphql-1.8.7
- old
+ new
@@ -14,13 +14,15 @@
# Mixed
["BirdType", "wingspan:!Int", "foliage:[Color]"],
]
expected_content = <<-RUBY
-class Types::BirdType < Types::BaseObject
- field :wingspan, Integer, null: false
- field :foliage, [Types::ColorType], null: true
+module Types
+ class BirdType < Types::BaseObject
+ field :wingspan, Integer, null: false
+ field :foliage, [Types::ColorType], null: true
+ end
end
RUBY
commands.each do |c|
prepare_destination
@@ -30,19 +32,23 @@
end
test "it generates classifed file" do
run_generator(["page"])
assert_file "app/graphql/types/page_type.rb", <<-RUBY
-class Types::PageType < Types::BaseObject
+module Types
+ class PageType < Types::BaseObject
+ end
end
RUBY
end
test "it makes Relay nodes" do
run_generator(["Page", "--node"])
assert_file "app/graphql/types/page_type.rb", <<-RUBY
-class Types::PageType < Types::BaseObject
- implements GraphQL::Relay::Node.interface
+module Types
+ class PageType < Types::BaseObject
+ implements GraphQL::Relay::Node.interface
+ end
end
RUBY
end
end