lib/service_contract/assertions.rb in service_contract-0.4.1 vs lib/service_contract/assertions.rb in service_contract-0.5.0

- old
+ new

@@ -8,10 +8,10 @@ def assert_data_matches_type(data, type, allow_nil = true) # Skip out if object is nil and allowed to be nil return true if data.nil? && allow_nil # basic type checking - assert type.valid_ruby_types.any?{|type| data.is_a?(type) }, "expected #{type.name} to be one of #{type.valid_ruby_types}" + assert type.valid_type?(data), "expected `#{data}` (#{type.name}) to be one of #{type.valid_ruby_types}" assert type.valid_value?(data), "#{data} is not an allowed value of type: #{type.name}" # check subtype if type.subtype data.each do |datum|