Sha256: ede5ed7cfa4825c5e859f9ec136c77afb93149e988edbe5269cf1f4f25da8224

Contents?: true

Size: 1.2 KB

Versions: 16

Compression:

Stored size: 1.2 KB

Contents

require 'spec_helper'

module Spree
  describe Admin::StockTransfersController, :type => :controller do
    stub_authorization!

    let!(:stock_transfer1) {
      StockTransfer.create do |transfer|
        transfer.source_location_id = 1
        transfer.destination_location_id = 2
        transfer.reference = 'PO 666'
      end }

    let!(:stock_transfer2) {
      StockTransfer.create do |transfer|
        transfer.source_location_id = 3
        transfer.destination_location_id = 4
        transfer.reference = 'PO 666'
      end }


    context "#index" do
      it "gets all transfers without search criteria" do
        spree_get :index
        expect(assigns[:stock_transfers].count).to eq 2
      end

      it "searches by source location" do
        spree_get :index, :q => { :source_location_id_eq => 1 }
        expect(assigns[:stock_transfers].count).to eq 1
        expect(assigns[:stock_transfers]).to include(stock_transfer1)
      end

      it "searches by destination location" do
        spree_get :index, :q => { :destination_location_id_eq => 4 }
        expect(assigns[:stock_transfers].count).to eq 1
        expect(assigns[:stock_transfers]).to include(stock_transfer2)
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
spree_backend-3.1.5 spec/controllers/spree/admin/stock_transfers_controller_spec.rb
spree_backend-3.1.4 spec/controllers/spree/admin/stock_transfers_controller_spec.rb
spree_backend-3.1.3 spec/controllers/spree/admin/stock_transfers_controller_spec.rb
spree_backend-3.1.2 spec/controllers/spree/admin/stock_transfers_controller_spec.rb
spree_backend-3.0.10 spec/controllers/spree/admin/stock_transfers_controller_spec.rb
spree_backend-3.1.1 spec/controllers/spree/admin/stock_transfers_controller_spec.rb
spree_backend-3.1.0 spec/controllers/spree/admin/stock_transfers_controller_spec.rb
spree_backend-3.1.0.rc4 spec/controllers/spree/admin/stock_transfers_controller_spec.rb
spree_backend-3.0.9 spec/controllers/spree/admin/stock_transfers_controller_spec.rb
spree_backend-3.1.0.rc3 spec/controllers/spree/admin/stock_transfers_controller_spec.rb
spree_backend-3.1.0.rc2 spec/controllers/spree/admin/stock_transfers_controller_spec.rb
spree_backend-3.1.0.rc1 spec/controllers/spree/admin/stock_transfers_controller_spec.rb
spree_backend-3.0.8 spec/controllers/spree/admin/stock_transfers_controller_spec.rb
spree_backend-3.0.7 spec/controllers/spree/admin/stock_transfers_controller_spec.rb
spree_backend-3.0.6.1 spec/controllers/spree/admin/stock_transfers_controller_spec.rb
spree_backend-3.0.6 spec/controllers/spree/admin/stock_transfers_controller_spec.rb