Родитель
cd56478c90
Коммит
d12d343e8a
|
@ -29,7 +29,7 @@ module GraphQL
|
|||
# block - Optional block to configure class
|
||||
def initialize(uri, &block)
|
||||
@uri = URI.parse(uri)
|
||||
class_eval(&block) if block_given?
|
||||
singleton_class.class_eval(&block) if block_given?
|
||||
end
|
||||
|
||||
# Public: Parsed endpoint URI
|
||||
|
|
|
@ -3,8 +3,10 @@ require "graphql/client/http"
|
|||
require "minitest/autorun"
|
||||
|
||||
class TestHTTP < MiniTest::Test
|
||||
def setup
|
||||
@http = GraphQL::Client::HTTP.new("http://graphql-swapi.parseapp.com/")
|
||||
SWAPI = GraphQL::Client::HTTP.new("http://graphql-swapi.parseapp.com/") do
|
||||
def headers(_context)
|
||||
{ "User-Agent" => "GraphQL/1.0" }
|
||||
end
|
||||
end
|
||||
|
||||
def test_execute
|
||||
|
@ -28,7 +30,7 @@ class TestHTTP < MiniTest::Test
|
|||
}
|
||||
}
|
||||
}
|
||||
actual = @http.execute(document: document, operation_name: name, variables: variables)
|
||||
actual = SWAPI.execute(document: document, operation_name: name, variables: variables)
|
||||
assert_equal(expected, actual)
|
||||
end
|
||||
end
|
||||
|
|
Загрузка…
Ссылка в новой задаче