Sha256: fe5b52ca4d63cdebc8edfba37bbdfb5384d5f8e8543dd5ac4dc88d8630994a5e

Contents?: true

Size: 1.15 KB

Versions: 6

Compression:

Stored size: 1.15 KB

Contents

require 'spec_helper'

describe Spree::Admin::PricesController do
  stub_authorization!

  let!(:product) { create(:product) }

  describe '#index' do
    context "when only given a product" do
      let(:product) { create(:product) }

      subject { get :index, params: { product_id: product.slug } }

      it { is_expected.to be_success }

      it 'assigns usable instance variables' do
        subject
        expect(assigns(:search)).to be_a(Ransack::Search)
        expect(assigns(:prices)).to eq(product.prices)
        expect(assigns(:product)).to eq(product)
      end
    end

    context "when given a product and a variant" do
      let(:variant) { create(:variant) }
      let(:product) { variant.product }

      subject { get :index, params: { product_id: product.slug, variant_id: variant.id } }

      it { is_expected.to be_success }

      it 'assigns usable instance variables' do
        subject
        expect(assigns(:search)).to be_a(Ransack::Search)
        expect(assigns(:prices)).to eq(product.prices)
        expect(assigns(:prices)).to include(variant.default_price)
        expect(assigns(:product)).to eq(product)
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
solidus_backend-2.0.3 spec/controllers/spree/admin/prices_controller_spec.rb
solidus_backend-2.0.2 spec/controllers/spree/admin/prices_controller_spec.rb
solidus_backend-2.0.1 spec/controllers/spree/admin/prices_controller_spec.rb
solidus_backend-2.0.0 spec/controllers/spree/admin/prices_controller_spec.rb
solidus_backend-2.0.0.rc1 spec/controllers/spree/admin/prices_controller_spec.rb
solidus_backend-2.0.0.beta1 spec/controllers/spree/admin/prices_controller_spec.rb