Sha256: a121e25987986bd01d2aa36ad38afe85fe09327323d1fb92f327191e02fd9fb2

Contents?: true

Size: 1.24 KB

Versions: 41

Compression:

Stored size: 1.24 KB

Contents

require 'spec_helper'

describe 'current order tracking', :type => :controller do
  let(:user) { create(:user) }

  controller(Spree::StoreController) do
    def index
      render :nothing => true
    end
  end

  let(:order) { FactoryGirl.create(:order) }

  it 'automatically tracks who the order was created by & IP address' do
    allow(controller).to receive_messages(:try_spree_current_user => user)
    get :index
    expect(controller.current_order(create_order_if_necessary: true).created_by).to eq controller.try_spree_current_user
    expect(controller.current_order.last_ip_address).to eq "0.0.0.0"
  end

  context "current order creation" do
    before { allow(controller).to receive_messages(:try_spree_current_user => user) }

    it "doesn't create a new order out of the blue" do
      expect {
        spree_get :index
      }.not_to change { Spree::Order.count }
    end
  end
end

describe Spree::OrdersController, :type => :controller do
  let(:user) { create(:user) }

  before { allow(controller).to receive_messages(:try_spree_current_user => user) }

  describe Spree::OrdersController do
    it "doesn't create a new order out of the blue" do
      expect {
        spree_get :edit
      }.not_to change { Spree::Order.count }
    end
  end
end

Version data entries

41 entries across 41 versions & 2 rubygems

Version Path
solidus_frontend-1.2.3 spec/controllers/spree/current_order_tracking_spec.rb
solidus_frontend-1.1.4 spec/controllers/spree/current_order_tracking_spec.rb
solidus_frontend-1.0.7 spec/controllers/spree/current_order_tracking_spec.rb
spree_frontend-3.1.5 spec/controllers/spree/current_order_tracking_spec.rb
spree_frontend-3.1.4 spec/controllers/spree/current_order_tracking_spec.rb
spree_frontend-3.1.3 spec/controllers/spree/current_order_tracking_spec.rb
spree_frontend-3.1.2 spec/controllers/spree/current_order_tracking_spec.rb
spree_frontend-3.0.10 spec/controllers/spree/current_order_tracking_spec.rb
spree_frontend-3.1.1 spec/controllers/spree/current_order_tracking_spec.rb
spree_frontend-3.1.0 spec/controllers/spree/current_order_tracking_spec.rb
spree_frontend-3.1.0.rc4 spec/controllers/spree/current_order_tracking_spec.rb
spree_frontend-3.0.9 spec/controllers/spree/current_order_tracking_spec.rb
spree_frontend-3.1.0.rc3 spec/controllers/spree/current_order_tracking_spec.rb
spree_frontend-3.1.0.rc2 spec/controllers/spree/current_order_tracking_spec.rb
spree_frontend-3.1.0.rc1 spec/controllers/spree/current_order_tracking_spec.rb
solidus_frontend-1.0.6 spec/controllers/spree/current_order_tracking_spec.rb
spree_frontend-3.0.8 spec/controllers/spree/current_order_tracking_spec.rb
solidus_frontend-1.2.2 spec/controllers/spree/current_order_tracking_spec.rb
spree_frontend-3.0.7 spec/controllers/spree/current_order_tracking_spec.rb
solidus_frontend-1.2.1 spec/controllers/spree/current_order_tracking_spec.rb