# frozen_string_literal: true

module Spree
  RSpec.describe ShippingMethod, type: :model do
    let(:shipping_method) { create(:shipping_method) }

    context "when soft-deleting" do
      subject(:soft_deleting) do
        shipping_method.discard
        shipping_method.reload
      end

      it "keeps the translation on deletion" do
        soft_deleting
        expect(shipping_method.translations).not_to be_empty
      end
    end
  end
end

Add specs around discarding Spree::ShippingMethod
Add specs around discarding Spree::ShippingMethod

This is the only model (with Spree::Product) that has
paranoia/discard enabled. This commit does not change the
behavior but adds some specs to describe what's the expected one:
when a shipping method is soft-deleted, translations are kept.

A future improvement could be adding the deleted_at column to
that translation table (as it's done with produts) and adding
discard to that model in order to mark as discarded the
translations associated to a discared shipping method.
