Commit df0c3fbed341711668bdb8e73393edef6ebfb646
Committed by
Rodrigo Souto
1 parent
f60a0173
Exists in
master
and in
28 other branches
shopping_cart delivery: fix delivery options not saving
(ActionItem2893)
Showing
2 changed files
with
9 additions
and
1 deletions
Show diff stats
plugins/shopping_cart/controllers/shopping_cart_plugin_myprofile_controller.rb
... | ... | @@ -63,7 +63,7 @@ class ShoppingCartPluginMyprofileController < MyProfileController |
63 | 63 | |
64 | 64 | def treat_delivery_options(params) |
65 | 65 | result = {} |
66 | - return result if params.nil? || params[:delivery_options].nil? | |
66 | + return result if params.nil? || params[:options].nil? | |
67 | 67 | params[:options].size.times do |counter| |
68 | 68 | if params[:options][counter].present? && params[:prices][counter].present? |
69 | 69 | result[params[:options][counter]] = params[:prices][counter] | ... | ... |
plugins/shopping_cart/test/functional/shopping_cart_plugin_myprofile_controller_test.rb
... | ... | @@ -51,6 +51,14 @@ class ShoppingCartPluginMyprofileControllerTest < ActionController::TestCase |
51 | 51 | assert settings.delivery_price == price |
52 | 52 | end |
53 | 53 | |
54 | + should 'be able to choose delivery_options' do | |
55 | + delivery_options = {:options => ['car', 'bike'], :prices => ['20', '5']} | |
56 | + post :edit, :profile => enterprise.identifier, :settings => {:delivery_options => delivery_options} | |
57 | + | |
58 | + assert_equal '20', settings.delivery_options['car'] | |
59 | + assert_equal '5', settings.delivery_options['bike'] | |
60 | + end | |
61 | + | |
54 | 62 | should 'filter the reports correctly' do |
55 | 63 | another_enterprise = fast_create(Enterprise) |
56 | 64 | po1 = ShoppingCartPlugin::PurchaseOrder.create!(:seller => enterprise, :status => ShoppingCartPlugin::PurchaseOrder::Status::OPENED) | ... | ... |