module OpenFoodNetwork
  module EmailHelper
    # Some specs trigger actions that send emails, for example creating an order.
    # But sending emails doesn't work out-of-the-box. This code sets it up.
    # It's here in a single place to allow an easy upgrade to Spree 2 which
    # needs a different implementation of this method.
    def setup_email
      Spree::Config[:mails_from] = "test@ofn.example.org"
    end

    # Ensures the value `perform_deliveries` had is restored. This saves us
    # from messing up with the test suite's global state which is cause of
    # trouble.
    def performing_deliveries
      old_value = ActionMailer::Base.perform_deliveries
      ActionMailer::Base.perform_deliveries = true

      yield

      ActionMailer::Base.perform_deliveries = old_value
    end
  end
end

module OpenFoodNetwork
  module EmailHelper
    # Some specs trigger actions that send emails, for example creating an order.
    # But sending emails doesn't work out-of-the-box. This code sets it up.
    def setup_email
      Spree::Config[:mails_from] = "test@ofn.example.org"
    end

    # Ensures the value `perform_deliveries` had is restored. This saves us
    # from messing up with the test suite's global state which is cause of
    # trouble.
    def performing_deliveries
      old_value = ActionMailer::Base.perform_deliveries
      ActionMailer::Base.perform_deliveries = true

      yield

      ActionMailer::Base.perform_deliveries = old_value
    end
  end
end

Remove comment refering to old spree upgrade
Remove comment refering to old spree upgrade
