Files
openfoodnetwork/spec/controllers/spree/admin/mail_methods_controller_spec.rb
Pau Perez 4a5869b60c Remove ability to toggle mail delivery
OFN requires mails to work so there's no point in having this
conditional with the maintenance cost it entails.
2021-01-25 13:27:44 +01:00

34 lines
1.0 KiB
Ruby

# frozen_string_literal: true
require 'spec_helper'
describe Spree::Admin::MailMethodsController do
include AuthenticationHelper
before { controller_login_as_admin }
context "#update" do
it "should reinitialize the mail settings" do
expect(Spree::Core::MailSettings).to receive(:init)
spree_put :update, mails_from: "ofn@example.com"
end
end
it "can trigger testmail" do
request.env["HTTP_REFERER"] = "/"
user = double('User', email: 'user@example.com',
spree_api_key: 'fake',
id: nil,
owned_groups: nil)
allow(user).to receive_messages(enterprises: [create(:enterprise)],
has_spree_role?: true,
locale: nil)
allow(controller).to receive_messages(spree_current_user: user)
ActionMailer::Base.perform_deliveries = true
expect {
spree_post :testmail
}.to change { ActionMailer::Base.deliveries.size }.by(1)
end
end