Skip to content

Commit

Permalink
Update tests for new interface
Browse files Browse the repository at this point in the history
  • Loading branch information
rmosolgo committed Jul 13, 2017
1 parent 653e5b9 commit dbf2924
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
1 change: 1 addition & 0 deletions spec/graphql/introspection/type_type_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"milkType"=>{
"interfaces"=>[
{"name"=>"Edible"},
{"name"=>"EdibleAsMilk"},
{"name"=>"AnimalProduct"},
{"name"=>"LocalProduct"},
],
Expand Down
11 changes: 8 additions & 3 deletions spec/graphql/object_type_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@

describe "interfaces" do
it "may have interfaces" do
assert_equal([Dummy::EdibleInterface, Dummy::AnimalProductInterface, Dummy::LocalProductInterface], type.interfaces)
assert_equal([
Dummy::EdibleInterface,
Dummy::EdibleAsMilkInterface,
Dummy::AnimalProductInterface,
Dummy::LocalProductInterface
], type.interfaces)
end

it "raises if the interfaces arent an array" do
Expand Down Expand Up @@ -129,8 +134,8 @@

type_2.fields["nonsense"] = GraphQL::Field.define(name: "nonsense", type: type)

assert_equal 3, type.interfaces.size
assert_equal 4, type_2.interfaces.size
assert_equal 4, type.interfaces.size
assert_equal 5, type_2.interfaces.size
assert_equal 8, type.fields.size
assert_equal 9, type_2.fields.size
end
Expand Down
1 change: 1 addition & 0 deletions spec/graphql/schema/traversal_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ def reduce_types(types)
"Float" => GraphQL::FLOAT_TYPE,
"String" => GraphQL::STRING_TYPE,
"Edible" => Dummy::EdibleInterface,
"EdibleAsMilk" => Dummy::EdibleAsMilkInterface,
"DairyAnimal" => Dummy::DairyAnimalEnum,
"Int" => GraphQL::INT_TYPE,
"AnimalProduct" => Dummy::AnimalProductInterface,
Expand Down
2 changes: 1 addition & 1 deletion spec/support/dummy/data.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def ==(other)
end

# Alias for when this is treated as milk in EdibleAsMilkInterface
def fatContent
def fatContent # rubocop:disable Style/MethodName
fat_content
end
end
Expand Down

0 comments on commit dbf2924

Please sign in to comment.