Fixes #9
This commit is contained in:
Joshua Peek 2016-09-26 22:02:53 -04:00
Родитель cd56478c90
Коммит d12d343e8a
2 изменённых файлов: 6 добавлений и 4 удалений

Просмотреть файл

@ -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