test/service_test.rb in service_contract-0.3.0 vs test/service_test.rb in service_contract-0.4.0
- old
+ new
@@ -66,11 +66,24 @@
field = type.fields.detect{|field| field.name == 'customer_id'}
assert(field, 'expected to find a customer_id field')
field_type = field.type
- assert_equal('union', field_type.name)
- assert_equal('null, int, Array(int)', field_type.to_s)
+ assert_equal('Union(null, int, Array(int))', field_type.name)
assert_equal([NilClass, Fixnum, Array], field_type.valid_ruby_types)
end
-end
\ No newline at end of file
+ def test_enum_types
+ service = SampleService.find(2)
+ protocol = service.protocol('social_login')
+ type = protocol.type('Authorization')
+
+ field = type.fields.detect{|field| field.name == 'provider'}
+ assert(field, 'expected to find a provider field')
+
+ field_type = field.type
+
+ assert_equal('Enum(SocialNetwork)', field_type.name)
+ assert_equal([String], field_type.valid_ruby_types)
+ end
+
+end