Replace XML with JSON serialization across the test suite

This allows us to remove the dependency on the XML serializer provided
by the external `activemodel-serializers-xml` gem, and eliminates the
following deprecation warning:

    DEPRECATION WARNING: ActiveModel::Errors#to_xml is deprecated and
    will be removed in Rails 6.2.

Please note: this does not mean Devise doesn't support XML, it simply
means our test suite will use JSON to test non-navigatable formats
instead of XML, for simplicity. Devise's job is not to test object
serialization, so as long as your objects properly serialize to
XML/JSON/any other format, it should work out of the box.
This commit is contained in:
Carlos Antonio da Silva
2021-02-10 17:17:29 -03:00
parent ad91686b62
commit a793472a3e
18 changed files with 104 additions and 187 deletions

View File

@@ -5,7 +5,6 @@ require 'shared_user'
class User < ActiveRecord::Base
include Shim
include SharedUser
include ActiveModel::Serializers::Xml if Devise::Test.rails5_and_up?
validates :sign_in_count, presence: true

View File

@@ -3,7 +3,8 @@
class UsersController < ApplicationController
prepend_before_action :current_user, only: :exhibit
before_action :authenticate_user!, except: [:accept, :exhibit]
respond_to :html, :xml
clear_respond_to
respond_to :html, :json
def index
user_session[:cart] = "Cart"