test/assertions_test.rb in service_contract-0.1.1 vs test/assertions_test.rb in service_contract-0.2.0
- old
+ new
@@ -56,6 +56,26 @@
# should be able to be an array of ints
assert_endpoint_response([{customer_id: [1,2,3]}], endpoint)
end
+ def test_uncontracted_data_not_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
+ failure_data = nil
+ begin
+ assert_endpoint_response([{customer_id: nil, bogus_param: 1}], endpoint)
+ rescue Minitest::Assertion => failure
+ failure_data = failure
+ end
+
+ assert !failure_data.nil?
+ assert failure_data.to_s.include?("not described in contract: bogus_param")
+
+ end
+
end
\ No newline at end of file