Sha256: 510592c141e9b734ce6efaa62deb9ebf7dec8ea0996dd29e2771e8bc7833fe9a

Contents?: true

Size: 984 Bytes

Versions: 1

Compression:

Stored size: 984 Bytes

Contents

# frozen_string_literal: true

require 'spec_helper'

describe Spree::Admin::PromotionCodesController, type: :controller do
  stub_authorization!

  let(:promotion) { create(:promotion) }
  let(:code1) { create(:promotion_code, promotion: promotion) }
  let(:code2) { create(:promotion_code, promotion: promotion) }
  let(:code3) { create(:promotion_code, promotion: promotion) }

  context 'with pagination' do
    it 'can page through the products' do
      get :index,
        params: {
          promotion_id: promotion.id,
          page: 1
        }
      expect(assigns[:pagy].page).to eq(1)
      expect(assigns[:pagy].items).to eq(50)
    end
  end

  describe '#index' do
    it 'returns 200 as HTML' do
      get :index, params: { promotion_id: promotion.id }

      expect(response.status).to be(200)
    end

    it 'returns 200 as CSV' do
      get :index, params: { promotion_id: promotion.id, format: :csv }

      expect(response.status).to be(200)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
solidus_pagy-1.0.0 spec/controllers/spree/admin/promotion_codes_controller_spec.rb