test/excon/resource_object_test.rb in excon-hypermedia-0.5.3 vs test/excon/resource_object_test.rb in excon-hypermedia-0.6.0
- old
+ new
@@ -7,21 +7,21 @@
#
# Validate the workings of `Excon::HyperResource::ResourceObject`.
#
class ResourceObjectTest < Minitest::Test
def body
- <<-EOF
+ <<-JSON
{
"_links": {
"hello": {
"href": "https://example.org/hello/{location}"
}
},
"uid": "universe",
"hello": "world"
}
- EOF
+ JSON
end
def data
@data ||= JSON.parse(body)
end
@@ -40,13 +40,18 @@
def test_properties
assert_equal 'universe', resource.uid
assert_equal 'world', resource.hello
assert_equal 'world', resource['hello']
- assert_equal nil, resource['invalid']
+ assert_nil resource['invalid']
end
def test_correctly_raising_no_method_error
assert_raises(NoMethodError) { resource.invalid }
+ end
+
+ def test_correctly_respond_to
+ assert_equal true, resource.respond_to?(:hello)
+ assert_equal false, resource.respond_to?(:invalid)
end
end
end