Commit f848b28053d024141759b03da7fdc600c27e5bbc
1 parent
9a7bbdf2
Exists in
master
and in
22 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,6 +63,7 @@ class ShoppingCartPluginMyprofileController < MyProfileController | ||
| 63 | 63 | ||
| 64 | def treat_delivery_options(params) | 64 | def treat_delivery_options(params) |
| 65 | result = {} | 65 | result = {} |
| 66 | + return result if params.nil? || params[:delivery_options].nil? | ||
| 66 | params[:options].size.times do |counter| | 67 | params[:options].size.times do |counter| |
| 67 | if params[:options][counter].present? && params[:prices][counter].present? | 68 | if params[:options][counter].present? && params[:prices][counter].present? |
| 68 | result[params[:options][counter]] = params[:prices][counter] | 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,7 +38,7 @@ class ShoppingCartPlugin::CartHelperTest < ActiveSupport::TestCase | ||
| 38 | value = 13.7 | 38 | value = 13.7 |
| 39 | environment = Environment.default | 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 | end | 42 | end |
| 43 | 43 | ||
| 44 | end | 44 | end |
plugins/shopping_cart/test/unit/shopping_cart_plugin_test.rb
| @@ -19,10 +19,9 @@ class ShoppingCartPluginTest < ActiveSupport::TestCase | @@ -19,10 +19,9 @@ class ShoppingCartPluginTest < ActiveSupport::TestCase | ||
| 19 | end | 19 | end |
| 20 | 20 | ||
| 21 | should 'not add button if product unavailable' do | 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 | enterprise.stubs(:shopping_cart).returns(true) | 24 | enterprise.stubs(:shopping_cart).returns(true) |
| 25 | - product.stubs(:enterprise).returns(enterprise) | ||
| 26 | 25 | ||
| 27 | assert_nil shopping_cart.add_to_cart_button(product) | 26 | assert_nil shopping_cart.add_to_cart_button(product) |
| 28 | end | 27 | end |