lib/active_model/serializer/lint.rb in cheap_ams-0.10.5 vs lib/active_model/serializer/lint.rb in cheap_ams-0.10.6

- old
+ new

@@ -13,19 +13,18 @@ # These tests do not attempt to determine the semantic correctness of the # returned values. For instance, you could implement <tt>serializable_hash</tt> to # always return +{}+, and the tests would pass. It is up to you to ensure # that the values are semantically meaningful. module Tests - # Passes if the object responds to <tt>serializable_hash</tt> and if it takes # zero or one arguments. # Fails otherwise. # # <tt>serializable_hash</tt> returns a hash representation of a object's attributes. # Typically, it is implemented by including ActiveModel::Serialization. def test_serializable_hash - assert_respond_to resource, :serializable_hash, "The resource should respond to serializable_hash" + assert_respond_to resource, :serializable_hash, 'The resource should respond to serializable_hash' resource.serializable_hash resource.serializable_hash(nil) end # Passes if the object responds to <tt>read_attribute_for_serialization</tt> @@ -33,11 +32,11 @@ # Fails otherwise. # # <tt>read_attribute_for_serialization</tt> gets the attribute value for serialization # Typically, it is implemented by including ActiveModel::Serialization. def test_read_attribute_for_serialization - assert_respond_to resource, :read_attribute_for_serialization, "The resource should respond to read_attribute_for_serialization" + assert_respond_to resource, :read_attribute_for_serialization, 'The resource should respond to read_attribute_for_serialization' actual_arity = resource.method(:read_attribute_for_serialization).arity if defined?(::Rubinius) # 1 for def read_attribute_for_serialization(name); end # -2 for alias :read_attribute_for_serialization :send for rbx because :shrug: assert_includes [1, -2], actual_arity, "expected #{actual_arity.inspect} to be 1 or -2" @@ -124,8 +123,7 @@ end def assert_instance_of(result, name) assert result.instance_of?(name), "#{result} should be an instance of #{name}" end - end end