Sha256: b79692518f0732708375aae5293521be622dcfe1c9b6210b7fe9b799af9877f8

Contents?: true

Size: 926 Bytes

Versions: 1

Compression:

Stored size: 926 Bytes

Contents

require 'test_helper'

class OrdersControllerTest < ActionController::TestCase
  fixtures :countries, :states, :gateways, :gateway_configurations
  
  context "on POST to :checkout" do
    setup do
      @order_attributes = {:bill_address_attributes => Factory.build(:address).attributes.symbolize_keys, 
                           :ship_address_attributes => Factory.build(:address).attributes.symbolize_keys} 
    end
    context "with no existing address" do
      setup do
        session[:order_id] = Factory.create(:order, :bill_address => nil, :ship_address => nil).id
        post :checkout, :order => @order_attributes
      end
      should_change "Address.count", :by => 2
    end
    context "with existing address" do
      setup do
        session[:order_id] = Factory.create(:order).id
        post :checkout, :order => @order_attributes
      end
      should_change "Address.count", :by => 2
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
kdmny-spree-0.0.1 test/functional/orders_controller_test.rb