Sha256: f90aa2356068cee0afe8eaab7c77cef09d86bdac096a86160b26904b36719142

Contents?: true

Size: 1.07 KB

Versions: 15

Compression:

Stored size: 1.07 KB

Contents

require 'spec_helper'

module Spree
  module Admin
    describe VariantsController, type: :controller do
      stub_authorization!

      describe "#index" do
        let(:product) { create(:product) }
        let!(:variant_1) { create(:variant, product: product) }
        let!(:variant_2) { create(:variant, product: product) }

        before { variant_2.destroy }

        context "deleted is not requested" do
          it "does not assign deleted variants for a requested product" do
            get :index, params: { product_id: product.slug }
            expect(assigns(:collection)).to include variant_1
            expect(assigns(:collection)).not_to include variant_2
          end
        end

        context "deleted is requested" do
          it "assigns deleted along with non-deleted variants for a requested product" do
            get :index, params: { product_id: product.slug, deleted: "on" }
            expect(assigns(:collection)).to include variant_1
            expect(assigns(:collection)).to include variant_2
          end
        end
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
solidus_backend-2.2.2 spec/controllers/spree/admin/variants_controller_spec.rb
solidus_backend-2.1.1 spec/controllers/spree/admin/variants_controller_spec.rb
solidus_backend-2.0.3 spec/controllers/spree/admin/variants_controller_spec.rb
solidus_backend-2.0.2 spec/controllers/spree/admin/variants_controller_spec.rb
solidus_backend-2.2.1 spec/controllers/spree/admin/variants_controller_spec.rb
solidus_backend-2.2.0 spec/controllers/spree/admin/variants_controller_spec.rb
solidus_backend-2.2.0.rc1 spec/controllers/spree/admin/variants_controller_spec.rb
solidus_backend-2.2.0.beta1 spec/controllers/spree/admin/variants_controller_spec.rb
solidus_backend-2.1.0 spec/controllers/spree/admin/variants_controller_spec.rb
solidus_backend-2.1.0.rc1 spec/controllers/spree/admin/variants_controller_spec.rb
solidus_backend-2.0.1 spec/controllers/spree/admin/variants_controller_spec.rb
solidus_backend-2.1.0.beta1 spec/controllers/spree/admin/variants_controller_spec.rb
solidus_backend-2.0.0 spec/controllers/spree/admin/variants_controller_spec.rb
solidus_backend-2.0.0.rc1 spec/controllers/spree/admin/variants_controller_spec.rb
solidus_backend-2.0.0.beta1 spec/controllers/spree/admin/variants_controller_spec.rb