test/assertions_test.rb in service_contract-0.0.10 vs test/assertions_test.rb in service_contract-0.1.0
- old
+ new
@@ -6,11 +6,11 @@
def test_data_matching
service = SampleService.find(1)
assert service, "expect to find a service by version"
assert_equal "1", service.version
- assert_equal 2, service.protocols.length
+ assert_equal 3, service.protocols.length
protocol = service.protocol("location")
endpoint = protocol.endpoint("index")
data = [{
id: 1,
@@ -37,8 +37,25 @@
timestamp: 1410278741
}
}]
assert_endpoint_response(data, endpoint)
+ end
+
+ def test_union_data_matching
+ service = SampleService.find(2)
+ assert service, "expect to find a service by version"
+
+ protocol = service.protocol("search_param")
+ endpoint = protocol.endpoint("index")
+
+ # test can be nil
+ assert_endpoint_response([{customer_id: nil}], endpoint)
+
+ # should be able to be an integer
+ assert_endpoint_response([{customer_id: 4}], endpoint)
+
+ # should be able to be an array of ints
+ assert_endpoint_response([{customer_id: [1,2,3]}], endpoint)
end
end
\ No newline at end of file