require 'spec_helper'

describe Spree::ProductsController, type: :controller do
  render_views

  context "GET #index" do
    subject { get :index, params: { format: 'rss' } }

    let!(:product) { create :product, name: "2 Hams", price: 20.00 }

    it { is_expected.to have_http_status :ok }

    it { is_expected.to render_template 'spree/products/index' }

    it 'returns the correct content type' do
      subject
      expect(response.content_type).to eq 'application/rss+xml'
    end
  end
end

require 'spec_helper'

describe Spree::ProductsController, type: :controller do
  render_views

  context "GET #index" do
    subject { get :index, params: { format: 'rss' } }

    let!(:product) { create :product, name: "2 Hams", price: 20.00 }

    it { is_expected.to have_http_status :ok }

    it { is_expected.to render_template 'spree/products/index' }

    it 'returns the correct content type' do
      subject
      expect(response.content_type.split(';').first).to eq 'application/rss+xml'
    end
  end
end

Fix content type spec on Rails 6
Fix content type spec on Rails 6

Rails 6 appends the charset to the content type of the response,
so we need to parse the content type properly in our test.
