Skip to content

Commit

Permalink
Fix method_str with hash_key
Browse files Browse the repository at this point in the history
  • Loading branch information
rmosolgo committed May 24, 2022
1 parent 3a47a4c commit adba39c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/graphql/schema/field.rb
Expand Up @@ -246,7 +246,7 @@ def initialize(type: nil, name: nil, owner: nil, null: nil, description: :not_gi
end
end

method_name = method || name_s
method_name = method || hash_key || name_s
@dig_keys = dig
if hash_key
@hash_key = hash_key
Expand Down
5 changes: 5 additions & 0 deletions spec/graphql/schema/field_spec.rb
Expand Up @@ -675,6 +675,11 @@ def ostruct_results
}
assert_equal expected_result, search_results
end

it "populates `method_str`" do
hash_key_field = HashKeySchema.get_field("Result", "method")
assert_equal "some_random_key", hash_key_field.method_str
end
end

describe "when the owner is nil" do
Expand Down

0 comments on commit adba39c

Please sign in to comment.