Sha256: f872fab5bf5a418ecc205fb60d133667b7a37c71e28992c6807d89bd79712655

Contents?: true

Size: 835 Bytes

Versions: 1

Compression:

Stored size: 835 Bytes

Contents

# frozen_string_literal: true

require 'spec_helper'

RSpec.describe Spree::Admin::NewslettersController, type: :controller do
  stub_authorization!

  before do
    SolidusNewsletter::Config[:title] = 'Newsletter'
    SolidusNewsletter::Config[:text] = 'Gets 10%'
  end

  context '#update' do
    it 'returns true' do
      put :update, params: { newsletters: { title: 'Newsletter Test', text: 'Gets 20%' } }

      expect(response.status).to eq(302)
      expect(SolidusNewsletter::Config[:title]).to eq('Newsletter Test')
      expect(SolidusNewsletter::Config[:text]).to eq('Gets 20%')
    end

    it 'returns false' do
      put :update, params: { newsletters: { title: '', text: '' } }

      expect(response.status).to eq(302)
      expect(flash[:error]).to include('Something went wrong, please try again')
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
solidus_newsletter-1.1 spec/controllers/spree/admin/newsletters_controller_spec.rb