diff --git a/activemodel/test/cases/serializable/json_test.rb b/activemodel/test/cases/serializable/json_test.rb
index <HASH>..<HASH> 100644
--- a/activemodel/test/cases/serializable/json_test.rb
+++ b/activemodel/test/cases/serializable/json_test.rb
@@ -14,9 +14,11 @@ class Contact
     end
   end
 
+  remove_method :attributes if method_defined?(:attributes)
+
   def attributes
     instance_values
-  end unless method_defined?(:attributes)
+  end
 end
 
 class JsonSerializationTest < ActiveModel::TestCase
diff --git a/activemodel/test/cases/serializable/xml_test.rb b/activemodel/test/cases/serializable/xml_test.rb
index <HASH>..<HASH> 100644
--- a/activemodel/test/cases/serializable/xml_test.rb
+++ b/activemodel/test/cases/serializable/xml_test.rb
@@ -9,6 +9,8 @@ class Contact
 
   attr_accessor :address, :friends
 
+  remove_method :attributes if method_defined?(:attributes)
+
   def attributes
     instance_values.except("address", "friends")
   end
fix method redefined warning in activemodel