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