test/excon/integration_test.rb in excon-hypermedia-0.5.2 vs test/excon/integration_test.rb in excon-hypermedia-0.5.3
- old
+ new
@@ -8,24 +8,20 @@
# IntegrationTest
#
# Verifies the Excon connection consuming HyperMedia APIs.
#
class IntegrationTest < HyperMediaTest
- def api
- Excon.get('https://www.example.org/api.json')
- end
-
def test_request
response = api.rel('product', expand: { uid: 'bicycle' }).get
- assert response.body.include?('https://www.example.org/product/bicycle')
+ assert response.body.include?('/product/bicycle')
end
def test_request_using_link_rel
response = api.resource._links.product.rel(expand: { uid: 'bicycle' }).get
- assert response.body.include?('https://www.example.org/product/bicycle')
+ assert response.body.include?('/product/bicycle')
end
def test_nested_request
bicycle = api.rel('product', expand: { uid: 'bicycle' }).get
response = bicycle.rel('handlebar').get
@@ -43,11 +39,11 @@
end
def test_expand_in_get
response = api.rel('product').get(expand: { uid: 'bicycle' })
- assert response.body.include?('https://www.example.org/product/bicycle')
+ assert response.body.include?('/product/bicycle')
end
def test_link
response = api.rel('product', expand: { uid: 'bicycle' }).get
@@ -87,16 +83,11 @@
assert_equal Array, response.resource._embedded.wheels.class
assert_equal data(:front_wheel)['position'], response.resource._embedded.wheels.first.position
end
def test_request_with_json_content_type
- api = Excon.get('https://www.example.org/api_v2.json', hypermedia: true)
- response = api.rel('product', expand: { uid: 'bicycle' }).get
+ response = api_v2.rel('product', expand: { uid: 'bicycle' }).get
- assert response.body.include?('https://www.example.org/product/bicycle')
- end
-
- def teardown
- Excon.stubs.clear
+ assert response.body.include?('/product/bicycle')
end
end
end