diff --git a/lib/active_model/serializer/lint.rb b/lib/active_model/serializer/lint.rb index daa21dca9..3552168e2 100644 --- a/lib/active_model/serializer/lint.rb +++ b/lib/active_model/serializer/lint.rb @@ -36,16 +36,10 @@ def test_serializable_hash def test_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" - else - # using absolute value since arity is: - # 1 for def read_attribute_for_serialization(name); end - # -1 for alias :read_attribute_for_serialization :send - assert_includes [1, -1], actual_arity, "expected #{actual_arity.inspect} to be 1 or -1" - end + # using absolute value since arity is: + # 1 for def read_attribute_for_serialization(name); end + # -1 for alias :read_attribute_for_serialization :send + assert_equal 1, actual_arity.abs, "expected #{actual_arity.inspect}.abs to be 1 or -1" end # Passes if the object responds to as_json and if it takes @@ -85,8 +79,7 @@ def test_to_json def test_cache_key assert_respond_to resource, :cache_key actual_arity = resource.method(:cache_key).arity - assert_includes [-1, 0], actual_arity, - "expected #{actual_arity.inspect} to be 0 or -1" + assert_includes [-1, 0], actual_arity, "expected #{actual_arity.inspect} to be 0 or -1" end # Passes if the object responds to updated_at and if it takes no