spree 0.10.0.beta → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of spree might be problematic. Click here for more details.
- data/README.markdown +36 -30
- data/app/controllers/admin/option_types_controller.rb +1 -1
- data/app/controllers/admin/payments_controller.rb +1 -1
- data/app/controllers/admin/products_controller.rb +4 -4
- data/app/controllers/admin/variants_controller.rb +2 -2
- data/app/controllers/checkouts_controller.rb +5 -11
- data/app/controllers/orders_controller.rb +10 -0
- data/app/controllers/user_sessions_controller.rb +16 -0
- data/app/models/product.rb +2 -1
- data/app/models/variant.rb +1 -1
- data/config/boot.rb +6 -6
- data/config/environment.rb +1 -1
- data/config/locales/cs-CZ.yml +12 -2
- data/config/locales/da.yml +12 -2
- data/config/locales/de-CH.yml +12 -2
- data/config/locales/de.yml +12 -2
- data/config/locales/en-AU.yml +12 -2
- data/config/locales/en-GB.yml +12 -2
- data/config/locales/en-US.yml +12 -2
- data/config/locales/es.yml +12 -2
- data/config/locales/fi.yml +12 -2
- data/config/locales/fr-FR.yml +12 -2
- data/config/locales/il.yml +12 -2
- data/config/locales/it.yml +12 -2
- data/config/locales/jp.yml +12 -2
- data/config/locales/mx.yml +12 -2
- data/config/locales/nb-NO.yml +12 -2
- data/config/locales/nl-BE.yml +12 -2
- data/config/locales/nl-NL.yml +12 -2
- data/config/locales/pl.yml +12 -2
- data/config/locales/pt-BR.yml +12 -2
- data/config/locales/pt-PT.yml +12 -2
- data/config/locales/ru-RU.yml +12 -2
- data/config/locales/th.yml +12 -2
- data/config/locales/vn.yml +12 -2
- data/db/migrate/20091021133257_charge_refactoring.rb +2 -2
- data/db/migrate/20100105132138_shipment_id_for_inventory_units.rb +4 -0
- data/db/schema.rb +1 -1
- data/lib/spree.rb +1 -1
- data/test/functional/admin/payments_controller_test.rb +7 -1
- data/test/integration/checkout_test.rb +59 -0
- data/test/test_helper.rb +1 -0
- data/test/unit/creditcard_test.rb +6 -0
- data/vendor/extensions/localization/app/controllers/locale_controller.rb +4 -1
- data/vendor/extensions/payment_gateway/lib/spree/payment_gateway.rb +1 -0
- data/vendor/extensions/theme_default/app/views/admin/option_types/selected.html.erb +1 -1
- data/vendor/extensions/theme_default/app/views/admin/orders/edit.html.erb +1 -0
- data/vendor/extensions/theme_default/app/views/admin/orders/new.html.erb +1 -0
- data/vendor/extensions/theme_default/app/views/admin/payments/_form.html.erb +1 -1
- data/vendor/extensions/theme_default/app/views/admin/payments/source_forms/_gateway.html.erb +2 -2
- data/vendor/extensions/theme_default/app/views/admin/products/_option_types.html.erb +1 -1
- data/vendor/extensions/theme_default/app/views/admin/shipments/edit.html.erb +1 -1
- data/vendor/extensions/theme_default/app/views/admin/shipments/index.html.erb +1 -1
- data/vendor/extensions/theme_default/app/views/admin/states/_state_list.html.erb +1 -1
- data/vendor/extensions/theme_default/app/views/admin/tax_categories/index.html.erb +1 -1
- data/vendor/extensions/theme_default/app/views/admin/zones/index.html.erb +1 -1
- data/vendor/extensions/theme_default/app/views/checkouts/_payment.html.erb +7 -11
- data/vendor/extensions/theme_default/app/views/checkouts/_summary.html.erb +9 -6
- data/vendor/extensions/theme_default/app/views/layouts/spree_application.html.erb +1 -1
- data/vendor/extensions/theme_default/app/views/shared/_login.html.erb +0 -1
- data/vendor/extensions/theme_default/app/views/users/_openid_identifier.html.erb +0 -1
- data/vendor/extensions/theme_default/public/javascripts/admin/orders/edit.js +1 -1
- data/vendor/extensions/theme_default/theme_default_extension.rb +0 -16
- data/vendor/plugins/resource_controller/lib/resource_controller/controller.rb +3 -3
- metadata +8 -9
data/config/locales/nl-NL.yml
CHANGED
@@ -515,6 +515,15 @@ nl-NL:
|
|
515
515
|
none_available: "Niet op voorraad"
|
516
516
|
not: not
|
517
517
|
note: Note
|
518
|
+
notice_messages:
|
519
|
+
option_type_removed: "Succesfully removed option type."
|
520
|
+
product_cloned: "Product has been cloned"
|
521
|
+
product_deleted: "Product has been deleted"
|
522
|
+
product_not_cloned: "Product could not be cloned"
|
523
|
+
product_not_deleted: "Product could not be deleted"
|
524
|
+
track_me_in_GA: "Track Me in GA"
|
525
|
+
variant_deleted: "Variant has been deleted"
|
526
|
+
variant_not_deleted: "Variant could not be deleted"
|
518
527
|
on_hand: "Op voorraad"
|
519
528
|
operation: Operatie
|
520
529
|
option_Values: "Waarden Opties"
|
@@ -609,12 +618,12 @@ nl-NL:
|
|
609
618
|
name: Ascend by product name
|
610
619
|
ascend_by_updated_at:
|
611
620
|
name: Ascend by actualization date
|
612
|
-
descend_by_popularity:
|
613
|
-
name: Sort by popularity(most popular first)
|
614
621
|
descend_by_master_price:
|
615
622
|
name: Descend by product master price
|
616
623
|
descend_by_name:
|
617
624
|
name: Descend by product name
|
625
|
+
descend_by_popularity:
|
626
|
+
name: Sort by popularity(most popular first)
|
618
627
|
descend_by_updated_at:
|
619
628
|
name: Descend by actualization date
|
620
629
|
in_name:
|
@@ -882,6 +891,7 @@ nl-NL:
|
|
882
891
|
use_as_shipping_address: "Gebruik als afleveringsadres"
|
883
892
|
use_billing_address: "Gebruik als factuuradres"
|
884
893
|
use_different_shipping_address: "Ander afleveringsadres gebruiken"
|
894
|
+
use_new_cc: "Use a new card"
|
885
895
|
user: Gebruiker
|
886
896
|
user_account: "Account Gebruiker"
|
887
897
|
user_created_successfully: "User created successfully"
|
data/config/locales/pl.yml
CHANGED
@@ -515,6 +515,15 @@ pl:
|
|
515
515
|
none_available: Niedostępne
|
516
516
|
not: not
|
517
517
|
note: Note
|
518
|
+
notice_messages:
|
519
|
+
option_type_removed: "Succesfully removed option type."
|
520
|
+
product_cloned: "Product has been cloned"
|
521
|
+
product_deleted: "Product has been deleted"
|
522
|
+
product_not_cloned: "Product could not be cloned"
|
523
|
+
product_not_deleted: "Product could not be deleted"
|
524
|
+
track_me_in_GA: "Track Me in GA"
|
525
|
+
variant_deleted: "Variant has been deleted"
|
526
|
+
variant_not_deleted: "Variant could not be deleted"
|
518
527
|
on_hand: "On Hand"
|
519
528
|
operation: Operacja
|
520
529
|
option_Values: "Wartości Opcji"
|
@@ -609,12 +618,12 @@ pl:
|
|
609
618
|
name: Ascend by product name
|
610
619
|
ascend_by_updated_at:
|
611
620
|
name: Ascend by actualization date
|
612
|
-
descend_by_popularity:
|
613
|
-
name: Sort by popularity(most popular first)
|
614
621
|
descend_by_master_price:
|
615
622
|
name: Descend by product master price
|
616
623
|
descend_by_name:
|
617
624
|
name: Descend by product name
|
625
|
+
descend_by_popularity:
|
626
|
+
name: Sort by popularity(most popular first)
|
618
627
|
descend_by_updated_at:
|
619
628
|
name: Descend by actualization date
|
620
629
|
in_name:
|
@@ -882,6 +891,7 @@ pl:
|
|
882
891
|
use_as_shipping_address: Use as Shipping Address
|
883
892
|
use_billing_address: Use Billing Address
|
884
893
|
use_different_shipping_address: "Użyj innego adresy dostawy"
|
894
|
+
use_new_cc: "Use a new card"
|
885
895
|
user: Użytkownik
|
886
896
|
user_account: User Account
|
887
897
|
user_created_successfully: "User created successfully"
|
data/config/locales/pt-BR.yml
CHANGED
@@ -515,6 +515,15 @@ pt-BR:
|
|
515
515
|
none_available: "Nenhum Disponível"
|
516
516
|
not: não
|
517
517
|
note: Note
|
518
|
+
notice_messages:
|
519
|
+
option_type_removed: "Succesfully removed option type."
|
520
|
+
product_cloned: "Product has been cloned"
|
521
|
+
product_deleted: "Product has been deleted"
|
522
|
+
product_not_cloned: "Product could not be cloned"
|
523
|
+
product_not_deleted: "Product could not be deleted"
|
524
|
+
track_me_in_GA: "Track Me in GA"
|
525
|
+
variant_deleted: "Variant has been deleted"
|
526
|
+
variant_not_deleted: "Variant could not be deleted"
|
518
527
|
on_hand: "Na Mão"
|
519
528
|
operation: Operação
|
520
529
|
option_Values: "Opção de Valores"
|
@@ -609,12 +618,12 @@ pt-BR:
|
|
609
618
|
name: Ascend by product name
|
610
619
|
ascend_by_updated_at:
|
611
620
|
name: Ascend by actualization date
|
612
|
-
descend_by_popularity:
|
613
|
-
name: Sort by popularity(most popular first)
|
614
621
|
descend_by_master_price:
|
615
622
|
name: Descend by product master price
|
616
623
|
descend_by_name:
|
617
624
|
name: Descend by product name
|
625
|
+
descend_by_popularity:
|
626
|
+
name: Sort by popularity(most popular first)
|
618
627
|
descend_by_updated_at:
|
619
628
|
name: Descend by actualization date
|
620
629
|
in_name:
|
@@ -882,6 +891,7 @@ pt-BR:
|
|
882
891
|
use_as_shipping_address: Use como Endereço de Entrega
|
883
892
|
use_billing_address: Use como Endereço de Cobrança
|
884
893
|
use_different_shipping_address: "Use um Endereço de Entrega Diferente"
|
894
|
+
use_new_cc: "Use a new card"
|
885
895
|
user: Usuário
|
886
896
|
user_account: Conta do Usuário
|
887
897
|
user_created_successfully: "User created successfully"
|
data/config/locales/pt-PT.yml
CHANGED
@@ -515,6 +515,15 @@ pt-PT:
|
|
515
515
|
none_available: "Nenhum Disponível"
|
516
516
|
not: not
|
517
517
|
note: Note
|
518
|
+
notice_messages:
|
519
|
+
option_type_removed: "Succesfully removed option type."
|
520
|
+
product_cloned: "Product has been cloned"
|
521
|
+
product_deleted: "Product has been deleted"
|
522
|
+
product_not_cloned: "Product could not be cloned"
|
523
|
+
product_not_deleted: "Product could not be deleted"
|
524
|
+
track_me_in_GA: "Track Me in GA"
|
525
|
+
variant_deleted: "Variant has been deleted"
|
526
|
+
variant_not_deleted: "Variant could not be deleted"
|
518
527
|
on_hand: "Em Stock"
|
519
528
|
operation: Operação
|
520
529
|
option_Values: "Valores Opcionais"
|
@@ -609,12 +618,12 @@ pt-PT:
|
|
609
618
|
name: Ascend by product name
|
610
619
|
ascend_by_updated_at:
|
611
620
|
name: Ascend by actualization date
|
612
|
-
descend_by_popularity:
|
613
|
-
name: Sort by popularity(most popular first)
|
614
621
|
descend_by_master_price:
|
615
622
|
name: Descend by product master price
|
616
623
|
descend_by_name:
|
617
624
|
name: Descend by product name
|
625
|
+
descend_by_popularity:
|
626
|
+
name: Sort by popularity(most popular first)
|
618
627
|
descend_by_updated_at:
|
619
628
|
name: Descend by actualization date
|
620
629
|
in_name:
|
@@ -882,6 +891,7 @@ pt-PT:
|
|
882
891
|
use_as_shipping_address: Use as Shipping Address
|
883
892
|
use_billing_address: Use Billing Address
|
884
893
|
use_different_shipping_address: "Use um Endereço de Entrega Diferente"
|
894
|
+
use_new_cc: "Use a new card"
|
885
895
|
user: Utilizador
|
886
896
|
user_account: User Account
|
887
897
|
user_created_successfully: "User created successfully"
|
data/config/locales/ru-RU.yml
CHANGED
@@ -515,6 +515,15 @@ ru-RU:
|
|
515
515
|
none_available: "Нет в наличии"
|
516
516
|
not: "не"
|
517
517
|
note: "Примечание"
|
518
|
+
notice_messages:
|
519
|
+
option_type_removed: "Товарная опция успешно убрана."
|
520
|
+
product_cloned: "Копия товара создана"
|
521
|
+
product_deleted: "Товар успешно удалён"
|
522
|
+
product_not_cloned: "Товар не может быть клонирован"
|
523
|
+
product_not_deleted: "Товар не может быть удалён"
|
524
|
+
track_me_in_GA: "Отслеживай меня в Google Analytics"
|
525
|
+
variant_deleted: "Вариант успешно удалён"
|
526
|
+
variant_not_deleted: "Вариант не может быть удален"
|
518
527
|
on_hand: "В наличии"
|
519
528
|
operation: "Операция"
|
520
529
|
option_Values: "Значения опции"
|
@@ -609,12 +618,12 @@ ru-RU:
|
|
609
618
|
name: "по названию товара (по алфавиту)"
|
610
619
|
ascend_by_updated_at:
|
611
620
|
name: "по дате обновления информации о товаре (прямой порядок)"
|
612
|
-
descend_by_popularity:
|
613
|
-
name: "По популярности (обратный порядок)"
|
614
621
|
descend_by_master_price:
|
615
622
|
name: "по основной цене товара (по убыванию)"
|
616
623
|
descend_by_name:
|
617
624
|
name: "по названию товара (по алфавиту в обратном порядке)"
|
625
|
+
descend_by_popularity:
|
626
|
+
name: "По популярности (обратный порядок)"
|
618
627
|
descend_by_updated_at:
|
619
628
|
name: "по дате обновления информации о товаре (обратный порядок)"
|
620
629
|
in_name:
|
@@ -882,6 +891,7 @@ ru-RU:
|
|
882
891
|
use_as_shipping_address: "Использовать как адрес доставки"
|
883
892
|
use_billing_address: "Использовать адрес для фактурации"
|
884
893
|
use_different_shipping_address: "использовать другой адрес доставки"
|
894
|
+
use_new_cc: "Использовать новую карту"
|
885
895
|
user: "Пользователь"
|
886
896
|
user_account: "Учетная запись пользователя"
|
887
897
|
user_created_successfully: "Учётная запись успешно создана"
|
data/config/locales/th.yml
CHANGED
@@ -515,6 +515,15 @@ th:
|
|
515
515
|
none_available: "None Available"
|
516
516
|
not: "ไม่"
|
517
517
|
note: Note
|
518
|
+
notice_messages:
|
519
|
+
option_type_removed: "Succesfully removed option type."
|
520
|
+
product_cloned: "Product has been cloned"
|
521
|
+
product_deleted: "Product has been deleted"
|
522
|
+
product_not_cloned: "Product could not be cloned"
|
523
|
+
product_not_deleted: "Product could not be deleted"
|
524
|
+
track_me_in_GA: "Track Me in GA"
|
525
|
+
variant_deleted: "Variant has been deleted"
|
526
|
+
variant_not_deleted: "Variant could not be deleted"
|
518
527
|
on_hand: สินค้าในคลัง
|
519
528
|
operation: Operation
|
520
529
|
option_Values: รายการตัวเลือก
|
@@ -609,12 +618,12 @@ th:
|
|
609
618
|
name: Ascend by product name
|
610
619
|
ascend_by_updated_at:
|
611
620
|
name: Ascend by actualization date
|
612
|
-
descend_by_popularity:
|
613
|
-
name: Sort by popularity(most popular first)
|
614
621
|
descend_by_master_price:
|
615
622
|
name: Descend by product master price
|
616
623
|
descend_by_name:
|
617
624
|
name: Descend by product name
|
625
|
+
descend_by_popularity:
|
626
|
+
name: Sort by popularity(most popular first)
|
618
627
|
descend_by_updated_at:
|
619
628
|
name: Descend by actualization date
|
620
629
|
in_name:
|
@@ -882,6 +891,7 @@ th:
|
|
882
891
|
use_as_shipping_address: ใช้ที่อยู่ในการจัดส่ง
|
883
892
|
use_billing_address: ใช้ที่อยู่ในใบเสร็จรับเงิน
|
884
893
|
use_different_shipping_address: "ใช้ที่อยู่อื่นในการจัดส่ง"
|
894
|
+
use_new_cc: "Use a new card"
|
885
895
|
user: ผู้ใช้
|
886
896
|
user_account: "บัญชีผู้ใช้"
|
887
897
|
user_created_successfully: "User created successfully"
|
data/config/locales/vn.yml
CHANGED
@@ -515,6 +515,15 @@ vn:
|
|
515
515
|
none_available: "Không có hàng nào"
|
516
516
|
not: không
|
517
517
|
note: Ghi chú
|
518
|
+
notice_messages:
|
519
|
+
option_type_removed: "Succesfully removed option type."
|
520
|
+
product_cloned: "Product has been cloned"
|
521
|
+
product_deleted: "Product has been deleted"
|
522
|
+
product_not_cloned: "Product could not be cloned"
|
523
|
+
product_not_deleted: "Product could not be deleted"
|
524
|
+
track_me_in_GA: "Track Me in GA"
|
525
|
+
variant_deleted: "Variant has been deleted"
|
526
|
+
variant_not_deleted: "Variant could not be deleted"
|
518
527
|
on_hand: "Có hàng"
|
519
528
|
operation: Hoạt động
|
520
529
|
option_Values: "Giá trị tùy chọn"
|
@@ -609,12 +618,12 @@ vn:
|
|
609
618
|
name: Xếp ngược thứ tự theo tên sản phẩm
|
610
619
|
ascend_by_updated_at:
|
611
620
|
name: Xếp ngược thứ tự theo ngày thật
|
612
|
-
descend_by_popularity:
|
613
|
-
name: Sắp xếp theo tính phổ biến (phổ biến nhất trước)
|
614
621
|
descend_by_master_price:
|
615
622
|
name: Xếp xuôi theo giá chủ của sản phẩm
|
616
623
|
descend_by_name:
|
617
624
|
name: Xếp xuôi theo tên sản phẩm
|
625
|
+
descend_by_popularity:
|
626
|
+
name: Sắp xếp theo tính phổ biến (phổ biến nhất trước)
|
618
627
|
descend_by_updated_at:
|
619
628
|
name: Xếp xuôi theo ngày thật
|
620
629
|
in_name:
|
@@ -882,6 +891,7 @@ vn:
|
|
882
891
|
use_as_shipping_address: Dùng như địa chỉ giao hàng
|
883
892
|
use_billing_address: Dùng địa chỉ thanh toán
|
884
893
|
use_different_shipping_address: "Dùng như địa chỉ giao hàng"
|
894
|
+
use_new_cc: "Use a new card"
|
885
895
|
user: Người dùng
|
886
896
|
user_account: Tài khoản người dùng
|
887
897
|
user_created_successfully: "Tạo người dùng thành công"
|
@@ -7,8 +7,8 @@ class ChargeRefactoring < ActiveRecord::Migration
|
|
7
7
|
|
8
8
|
def self.up
|
9
9
|
add_column :orders, :completed_at, :timestamp
|
10
|
-
Order.reset_column_information
|
11
|
-
Order.all.each{|o| o.update_attribute(:completed_at, o.checkout && o.checkout.completed_at)}
|
10
|
+
Order.reset_column_information
|
11
|
+
Order.all.each {|o| o.update_attribute(:completed_at, o.checkout && o.checkout.read_attribute(:completed_at)) }
|
12
12
|
remove_column :checkouts, :completed_at
|
13
13
|
|
14
14
|
change_column :adjustments, :amount, :decimal, :null => true, :default => nil, :precision => 8, :scale => 2
|
@@ -5,6 +5,10 @@ class ShipmentIdForInventoryUnits < ActiveRecord::Migration
|
|
5
5
|
|
6
6
|
# migrate legacy shipments
|
7
7
|
Shipment.all.each do |shipment|
|
8
|
+
unless shipment.order
|
9
|
+
puts "Warning: shipment has invalid order - #{shipment.id}"
|
10
|
+
next
|
11
|
+
end
|
8
12
|
shipment.order.inventory_units.each do |unit|
|
9
13
|
unit.update_attribute("shipment_id", shipment.id)
|
10
14
|
end
|
data/db/schema.rb
CHANGED
@@ -9,7 +9,7 @@
|
|
9
9
|
#
|
10
10
|
# It's strongly recommended to check this file into your version control system.
|
11
11
|
|
12
|
-
ActiveRecord::Schema.define(:version =>
|
12
|
+
ActiveRecord::Schema.define(:version => 20100306153445) do
|
13
13
|
|
14
14
|
create_table "addresses", :force => true do |t|
|
15
15
|
t.string "firstname"
|
data/lib/spree.rb
CHANGED
@@ -66,10 +66,11 @@ class Admin::PaymentsControllerTest < ActionController::TestCase
|
|
66
66
|
end
|
67
67
|
|
68
68
|
|
69
|
-
context "for
|
69
|
+
context "for check payment" do
|
70
70
|
setup do
|
71
71
|
@params = {
|
72
72
|
:order_id => @order.id,
|
73
|
+
:card => Factory(:creditcard).id,
|
73
74
|
:payment => {
|
74
75
|
:payment_method_id => payment_methods(:check_payment_method).id.to_s,
|
75
76
|
:amount => '1.99'
|
@@ -79,6 +80,11 @@ class Admin::PaymentsControllerTest < ActionController::TestCase
|
|
79
80
|
end
|
80
81
|
should_create :payment
|
81
82
|
should_respond_with :redirect
|
83
|
+
should "not be a check payment with no source" do
|
84
|
+
payment = Payment.first(:order => 'id DESC')
|
85
|
+
assert payment.source.nil?
|
86
|
+
assert payment.payment_method.is_a?(PaymentMethod::Check)
|
87
|
+
end
|
82
88
|
end
|
83
89
|
|
84
90
|
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class CheckoutTest < ActionController::IntegrationTest
|
4
|
+
context "Checkout" do
|
5
|
+
setup do
|
6
|
+
@user = Factory(:admin_user, :password=>'test', :password_confirmation=>'test')
|
7
|
+
@product = Factory(:product)
|
8
|
+
end
|
9
|
+
|
10
|
+
should "restore last not completed order, associated with user after log on, even if user start new order while was logged out." do
|
11
|
+
get '/login'
|
12
|
+
post_via_redirect '/user_sessions/create', {:user_session=>{:login=>@user.login, :password=>'test', :openid_identifier=>''}}
|
13
|
+
assert_response :success
|
14
|
+
assert_equal '/products', path
|
15
|
+
|
16
|
+
#####
|
17
|
+
# Create a new order while logged in
|
18
|
+
#####
|
19
|
+
post_via_redirect '/orders/create', {:variants=>{@product.master.id=>"1"}}
|
20
|
+
assert_response :success
|
21
|
+
first_order = Order.last
|
22
|
+
assert_equal "/orders/#{first_order.number}/edit", path
|
23
|
+
assert_equal @user.id, first_order.user_id
|
24
|
+
|
25
|
+
get_via_redirect '/logout'
|
26
|
+
assert_response :success
|
27
|
+
assert_equal nil, response.session[:order_token]
|
28
|
+
assert_equal nil, response.session[:order_id]
|
29
|
+
|
30
|
+
#####
|
31
|
+
# Create a new order while logged out
|
32
|
+
#####
|
33
|
+
post_via_redirect '/orders/create', {:variants=>{@product.master.id=>"1"}}
|
34
|
+
assert_response :success
|
35
|
+
second_order = Order.last
|
36
|
+
assert_equal "/orders/#{second_order.number}/edit", path
|
37
|
+
|
38
|
+
get_via_redirect "/orders/#{second_order.number}/checkout/edit"
|
39
|
+
assert_response :success
|
40
|
+
assert_equal "/orders/#{second_order.number}/checkout/register", path
|
41
|
+
|
42
|
+
#####
|
43
|
+
# Login Again, as part of the checkout/register step
|
44
|
+
#####
|
45
|
+
get '/login'
|
46
|
+
post_via_redirect '/user_sessions/create', {:user_session=>{:login=>@user.login, :password=>'test', :openid_identifier=>''}}
|
47
|
+
assert_response :success
|
48
|
+
#####
|
49
|
+
# We are properly redirected to the first order
|
50
|
+
#####
|
51
|
+
assert_equal "/orders/#{first_order.number}/checkout/edit", path
|
52
|
+
assert_equal first_order.token, response.session[:order_token]
|
53
|
+
assert_equal first_order.id, response.session[:order_id]
|
54
|
+
|
55
|
+
# line items from guest order should be added to restored uncompleted order
|
56
|
+
assert_equal first_order.total + second_order.total, first_order.reload.total
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
data/test/test_helper.rb
CHANGED
@@ -67,6 +67,9 @@ class CreditcardTest < ActiveSupport::TestCase
|
|
67
67
|
@creditcard.void(@payment)
|
68
68
|
end
|
69
69
|
should_change("CreditcardTxn.count", :by => 1) { CreditcardTxn.count }
|
70
|
+
should "update payment amount to zero" do
|
71
|
+
assert_equal 0.00, @payment.amount.to_f
|
72
|
+
end
|
70
73
|
end
|
71
74
|
end
|
72
75
|
context "followed by void" do
|
@@ -78,6 +81,9 @@ class CreditcardTest < ActiveSupport::TestCase
|
|
78
81
|
should "create new transaction with correct attributes" do
|
79
82
|
assert_equal CreditcardTxn::TxnType::VOID, @void_txn.txn_type
|
80
83
|
end
|
84
|
+
should "update payment amount to zero" do
|
85
|
+
assert_equal 0.00, @payment.amount.to_f
|
86
|
+
end
|
81
87
|
end
|
82
88
|
end
|
83
89
|
|
@@ -1,6 +1,9 @@
|
|
1
1
|
class LocaleController < ApplicationController
|
2
2
|
|
3
3
|
def set
|
4
|
+
if request.referer && request.referer.starts_with?("http://" + request.host)
|
5
|
+
session[:return_to] = request.referer
|
6
|
+
end
|
4
7
|
if params[:locale] && AVAILABLE_LOCALES.include?(params[:locale])
|
5
8
|
I18n.locale = params[:locale]
|
6
9
|
session[:locale] = params[:locale]
|
@@ -11,4 +14,4 @@ class LocaleController < ApplicationController
|
|
11
14
|
redirect_back_or_default(root_path)
|
12
15
|
end
|
13
16
|
|
14
|
-
end
|
17
|
+
end
|