Commit f848b28053d024141759b03da7fdc600c27e5bbc
1 parent
9a7bbdf2
Exists in
master
and in
28 other branches
[plugins-tests] Fixing shopping_cart tests
Showing
3 changed files
with
4 additions
and
4 deletions
Show diff stats
plugins/shopping_cart/controllers/shopping_cart_plugin_myprofile_controller.rb
... | ... | @@ -63,6 +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 | 67 | params[:options].size.times do |counter| |
67 | 68 | if params[:options][counter].present? && params[:prices][counter].present? |
68 | 69 | result[params[:options][counter]] = params[:prices][counter] | ... | ... |
plugins/shopping_cart/test/unit/shopping_cart_plugin/cart_helper_test.rb
... | ... | @@ -38,7 +38,7 @@ class ShoppingCartPlugin::CartHelperTest < ActiveSupport::TestCase |
38 | 38 | value = 13.7 |
39 | 39 | environment = Environment.default |
40 | 40 | |
41 | - assert_equal "#{environment.currency_unit} 13#{environment.currency_separator}70", float_to_currency_cart(value,environment) | |
41 | + assert_equal "#{environment.currency_unit}13#{environment.currency_separator}70", float_to_currency_cart(value,environment) | |
42 | 42 | end |
43 | 43 | |
44 | 44 | end | ... | ... |
plugins/shopping_cart/test/unit/shopping_cart_plugin_test.rb
... | ... | @@ -19,10 +19,9 @@ class ShoppingCartPluginTest < ActiveSupport::TestCase |
19 | 19 | end |
20 | 20 | |
21 | 21 | should 'not add button if product unavailable' do |
22 | - product = fast_create(Product, :available => false) | |
23 | - enterprise = mock() | |
22 | + enterprise = fast_create(:enterprise) | |
23 | + product = fast_create(Product, :available => false, :enterprise_id => enterprise.id) | |
24 | 24 | enterprise.stubs(:shopping_cart).returns(true) |
25 | - product.stubs(:enterprise).returns(enterprise) | |
26 | 25 | |
27 | 26 | assert_nil shopping_cart.add_to_cart_button(product) |
28 | 27 | end | ... | ... |