spree_core 2.4.10 → 3.0.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (155) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +1 -1
  3. data/app/assets/images/logo/spree_50.png +0 -0
  4. data/app/controllers/spree/base_controller.rb +1 -2
  5. data/app/helpers/spree/base_helper.rb +41 -131
  6. data/app/helpers/spree/products_helper.rb +1 -1
  7. data/app/models/concerns/spree/adjustment_source.rb +51 -15
  8. data/app/models/concerns/spree/calculated_adjustments.rb +1 -0
  9. data/app/models/concerns/spree/display_money.rb +32 -0
  10. data/app/models/concerns/spree/named_type.rb +1 -1
  11. data/app/models/concerns/spree/number_generator.rb +39 -0
  12. data/app/models/concerns/spree/user_reporting.rb +3 -8
  13. data/app/models/spree/address.rb +0 -2
  14. data/app/models/spree/adjustable/adjustments_updater.rb +70 -0
  15. data/app/models/spree/adjustable/promotion_accumulator.rb +75 -0
  16. data/app/models/spree/adjustment.rb +17 -26
  17. data/app/models/spree/app_configuration.rb +4 -33
  18. data/app/models/spree/base.rb +0 -3
  19. data/app/models/spree/calculator.rb +0 -5
  20. data/app/models/spree/classification.rb +1 -1
  21. data/app/models/spree/country.rb +10 -4
  22. data/app/models/spree/credit_card.rb +14 -15
  23. data/app/models/spree/customer_return.rb +18 -25
  24. data/app/models/spree/gateway/bogus.rb +0 -4
  25. data/app/models/spree/line_item.rb +2 -5
  26. data/app/models/spree/option_type.rb +2 -4
  27. data/app/models/spree/option_value.rb +0 -2
  28. data/app/models/spree/order.rb +74 -134
  29. data/app/models/spree/order/checkout.rb +1 -1
  30. data/app/models/spree/order_contents.rb +9 -8
  31. data/app/models/spree/order_updater.rb +8 -1
  32. data/app/models/spree/payment.rb +13 -23
  33. data/app/models/spree/payment/gateway_options.rb +86 -0
  34. data/app/models/spree/payment/processing.rb +8 -39
  35. data/app/models/spree/payment_method.rb +3 -6
  36. data/app/models/spree/price.rb +2 -6
  37. data/app/models/spree/product.rb +27 -16
  38. data/app/models/spree/product_property.rb +1 -5
  39. data/app/models/spree/promotion.rb +7 -15
  40. data/app/models/spree/promotion/actions/create_adjustment.rb +4 -45
  41. data/app/models/spree/promotion/actions/create_item_adjustments.rb +8 -63
  42. data/app/models/spree/promotion/actions/create_line_items.rb +3 -12
  43. data/app/models/spree/promotion/actions/free_shipping.rb +4 -24
  44. data/app/models/spree/promotion/rules/option_value.rb +49 -0
  45. data/app/models/spree/promotion_action.rb +6 -0
  46. data/app/models/spree/promotion_handler/cart.rb +14 -18
  47. data/app/models/spree/promotion_handler/coupon.rb +1 -1
  48. data/app/models/spree/promotion_rule.rb +0 -1
  49. data/app/models/spree/property.rb +0 -2
  50. data/app/models/spree/refund.rb +0 -15
  51. data/app/models/spree/reimbursement.rb +4 -4
  52. data/app/models/spree/reimbursement_type/credit.rb +1 -1
  53. data/app/models/spree/reimbursement_type/original_payment.rb +1 -1
  54. data/app/models/spree/return_authorization.rb +4 -11
  55. data/app/models/spree/return_item.rb +16 -11
  56. data/app/models/spree/return_item/eligibility_validator/default.rb +2 -0
  57. data/app/models/spree/return_item/eligibility_validator/inventory_shipped.rb +16 -0
  58. data/app/models/spree/return_item/eligibility_validator/no_reimbursements.rb +16 -0
  59. data/app/models/spree/shipment.rb +20 -31
  60. data/app/models/spree/shipment_handler.rb +1 -1
  61. data/app/models/spree/shipping_method.rb +12 -13
  62. data/app/models/spree/state.rb +7 -0
  63. data/app/models/spree/state_change.rb +1 -6
  64. data/app/models/spree/stock/availability_validator.rb +9 -10
  65. data/app/models/spree/stock/coordinator.rb +1 -1
  66. data/app/models/spree/stock/estimator.rb +6 -6
  67. data/app/models/spree/stock/quantifier.rb +1 -1
  68. data/app/models/spree/stock_item.rb +1 -7
  69. data/app/models/spree/stock_location.rb +3 -1
  70. data/app/models/spree/stock_movement.rb +1 -8
  71. data/app/models/spree/stock_transfer.rb +11 -5
  72. data/app/models/spree/store.rb +2 -2
  73. data/app/models/spree/tax_rate.rb +30 -55
  74. data/app/models/spree/taxon.rb +8 -8
  75. data/app/models/spree/taxonomy.rb +8 -13
  76. data/app/models/spree/tracker.rb +1 -1
  77. data/app/models/spree/variant.rb +6 -15
  78. data/app/models/spree/zone.rb +43 -9
  79. data/config/initializers/user_class_extensions.rb +0 -12
  80. data/config/locales/en.yml +76 -85
  81. data/config/routes.rb +1 -1
  82. data/db/default/spree/countries.rb +23 -13
  83. data/db/default/spree/states.rb +24 -12
  84. data/db/default/spree/stores.rb +1 -1
  85. data/db/migrate/20120831092320_spree_one_two.rb +36 -36
  86. data/db/migrate/20120831092359_spree_promo_one_two.rb +1 -1
  87. data/db/migrate/20130211190146_create_spree_stock_items.rb +1 -1
  88. data/db/migrate/20130211191120_create_spree_stock_locations.rb +1 -1
  89. data/db/migrate/20130301162924_create_shipping_method_categories.rb +1 -1
  90. data/db/migrate/20130304162240_create_spree_shipping_rates.rb +1 -1
  91. data/db/migrate/20130305143310_create_stock_movements.rb +1 -1
  92. data/db/migrate/20130418125341_create_spree_stock_transfers.rb +1 -1
  93. data/db/migrate/20140205120320_create_spree_payment_capture_events.rb +1 -1
  94. data/db/migrate/20140309024355_create_spree_stores.rb +1 -1
  95. data/db/migrate/20140309033438_create_store_from_preferences.rb +0 -7
  96. data/db/migrate/20140625214618_create_spree_refunds.rb +1 -1
  97. data/db/migrate/20140702140656_create_spree_return_authorization_inventory_unit.rb +1 -1
  98. data/db/migrate/20140713140455_create_spree_return_authorization_reasons.rb +1 -1
  99. data/db/migrate/20140713140527_create_spree_refund_reasons.rb +1 -1
  100. data/db/migrate/20140715182625_create_spree_promotion_categories.rb +1 -1
  101. data/db/migrate/20140718133010_create_spree_customer_returns.rb +1 -1
  102. data/db/migrate/20140725131539_create_spree_reimbursements.rb +1 -1
  103. data/db/migrate/20140731150017_create_spree_reimbursement_types.rb +1 -1
  104. data/db/migrate/20140911173301_add_kind_to_zone.rb +11 -0
  105. data/db/migrate/20141215232040_remove_token_permissions_table.rb +6 -0
  106. data/db/migrate/20141215235502_remove_extra_products_slug_index.rb +5 -0
  107. data/db/migrate/20141217215630_update_product_slug_index.rb +6 -0
  108. data/db/migrate/20141218025915_rename_identifier_to_number_for_payment.rb +5 -0
  109. data/db/migrate/20150121022521_remove_environment_from_payment_method.rb +6 -0
  110. data/db/migrate/20150122145607_add_resellable_to_return_items.rb +5 -0
  111. data/db/migrate/20150122202432_add_code_to_spree_promotion_categories.rb +5 -0
  112. data/db/migrate/20150128032538_remove_environment_from_tracker.rb +6 -0
  113. data/db/migrate/20150128060325_remove_spree_configurations.rb +16 -0
  114. data/lib/generators/spree/dummy/templates/rails/test.rb +1 -1
  115. data/lib/generators/spree/install/templates/config/initializers/spree.rb +4 -0
  116. data/lib/spree/core.rb +2 -12
  117. data/lib/spree/core/controller_helpers/respond_with.rb +8 -18
  118. data/lib/spree/core/engine.rb +1 -7
  119. data/lib/spree/core/routes.rb +1 -1
  120. data/lib/spree/core/version.rb +1 -1
  121. data/lib/spree/money.rb +10 -10
  122. data/lib/spree/permitted_attributes.rb +4 -8
  123. data/lib/spree/testing_support/authorization_helpers.rb +3 -5
  124. data/lib/spree/testing_support/capybara_ext.rb +3 -3
  125. data/lib/spree/testing_support/common_rake.rb +2 -2
  126. data/lib/spree/testing_support/factories/order_factory.rb +3 -13
  127. data/lib/spree/testing_support/factories/payment_method_factory.rb +0 -3
  128. data/lib/spree/testing_support/factories/prototype_factory.rb +5 -0
  129. data/lib/spree/testing_support/factories/return_item_factory.rb +5 -1
  130. data/lib/spree/testing_support/factories/stock_location_factory.rb +3 -3
  131. data/lib/spree/testing_support/factories/tracker_factory.rb +0 -1
  132. data/lib/spree/testing_support/factories/user_factory.rb +1 -1
  133. data/lib/spree/testing_support/factories/zone_factory.rb +8 -0
  134. data/lib/tasks/core.rake +1 -1
  135. data/lib/tasks/email.rake +6 -3
  136. metadata +48 -35
  137. data/app/helpers/spree/checkout_helper.rb +0 -31
  138. data/app/helpers/spree/orders_helper.rb +0 -17
  139. data/app/helpers/spree/store_helper.rb +0 -16
  140. data/app/helpers/spree/taxons_helper.rb +0 -19
  141. data/app/models/concerns/spree/ransackable_attributes.rb +0 -19
  142. data/app/models/friendly_id/slug_decorator.rb +0 -3
  143. data/app/models/spree/billing_integration.rb +0 -21
  144. data/app/models/spree/configuration.rb +0 -5
  145. data/app/models/spree/item_adjustments.rb +0 -82
  146. data/app/models/spree/order_merger.rb +0 -65
  147. data/app/models/spree/order_populator.rb +0 -43
  148. data/app/models/spree/product_scope/scopes.rb +0 -47
  149. data/app/models/spree/variant/scopes.rb +0 -42
  150. data/db/migrate/20150515211137_fix_adjustment_order_id.rb +0 -70
  151. data/db/migrate/20150522181728_add_deleted_at_to_friendly_id_slugs.rb +0 -6
  152. data/db/migrate/20150707204155_enable_acts_as_paranoid_on_calculators.rb +0 -6
  153. data/lib/spree/core/controller_helpers/ssl.rb +0 -60
  154. data/lib/spree/core/permalinks.rb +0 -71
  155. data/lib/spree/testing_support/factories/configuration_factory.rb +0 -6
@@ -5,7 +5,7 @@ class CreateSpreeStockTransfers < ActiveRecord::Migration
5
5
  t.string :reference_number
6
6
  t.integer :source_location_id
7
7
  t.integer :destination_location_id
8
- t.timestamps
8
+ t.timestamps null: false
9
9
  end
10
10
 
11
11
  add_index :spree_stock_transfers, :source_location_id
@@ -4,7 +4,7 @@ class CreateSpreePaymentCaptureEvents < ActiveRecord::Migration
4
4
  t.decimal :amount, precision: 10, scale: 2, default: 0.0
5
5
  t.integer :payment_id
6
6
 
7
- t.timestamps
7
+ t.timestamps null: false
8
8
  end
9
9
 
10
10
  add_index :spree_payment_capture_events, :payment_id
@@ -18,7 +18,7 @@ class CreateSpreeStores < ActiveRecord::Migration
18
18
  t.string :code
19
19
  t.boolean :default, default: false, null: false
20
20
 
21
- t.timestamps
21
+ t.timestamps null: false
22
22
  end
23
23
  end
24
24
  end
@@ -1,12 +1,5 @@
1
1
  class CreateStoreFromPreferences < ActiveRecord::Migration
2
2
  def change
3
- # workaround for spree_i18n and Store translations
4
- Spree::Store.class_eval do
5
- def self.translated?(name)
6
- false
7
- end
8
- end
9
-
10
3
  preference_store = Spree::Preferences::Store.instance
11
4
  if store = Spree::Store.where(default: true).first
12
5
  store.meta_description = preference_store.get('spree/app_configuration/default_meta_description') {}
@@ -6,7 +6,7 @@ class CreateSpreeRefunds < ActiveRecord::Migration
6
6
  t.decimal :amount, precision: 10, scale: 2, default: 0.0, null: false
7
7
  t.string :transaction_id
8
8
 
9
- t.timestamps
9
+ t.timestamps null: false
10
10
  end
11
11
  end
12
12
  end
@@ -6,7 +6,7 @@ class CreateSpreeReturnAuthorizationInventoryUnit < ActiveRecord::Migration
6
6
  t.integer :exchange_variant_id
7
7
  t.datetime :received_at
8
8
 
9
- t.timestamps
9
+ t.timestamps null: false
10
10
  end
11
11
  end
12
12
  end
@@ -5,7 +5,7 @@ class CreateSpreeReturnAuthorizationReasons < ActiveRecord::Migration
5
5
  t.boolean :active, default: true
6
6
  t.boolean :mutable, default: true
7
7
 
8
- t.timestamps
8
+ t.timestamps null: false
9
9
  end
10
10
 
11
11
  reversible do |direction|
@@ -5,7 +5,7 @@ class CreateSpreeRefundReasons < ActiveRecord::Migration
5
5
  t.boolean :active, default: true
6
6
  t.boolean :mutable, default: true
7
7
 
8
- t.timestamps
8
+ t.timestamps null: false
9
9
  end
10
10
 
11
11
  add_column :spree_refunds, :refund_reason_id, :integer
@@ -2,7 +2,7 @@ class CreateSpreePromotionCategories < ActiveRecord::Migration
2
2
  def change
3
3
  create_table :spree_promotion_categories do |t|
4
4
  t.string :name
5
- t.timestamps
5
+ t.timestamps null: false
6
6
  end
7
7
 
8
8
  add_column :spree_promotions, :promotion_category_id, :integer
@@ -3,7 +3,7 @@ class CreateSpreeCustomerReturns < ActiveRecord::Migration
3
3
  create_table :spree_customer_returns do |t|
4
4
  t.string :number
5
5
  t.integer :stock_location_id
6
- t.timestamps
6
+ t.timestamps null: false
7
7
  end
8
8
  end
9
9
  end
@@ -7,7 +7,7 @@ class CreateSpreeReimbursements < ActiveRecord::Migration
7
7
  t.integer :order_id
8
8
  t.decimal :total, precision: 10, scale: 2
9
9
 
10
- t.timestamps
10
+ t.timestamps null: false
11
11
  end
12
12
 
13
13
  add_index :spree_reimbursements, :customer_return_id
@@ -5,7 +5,7 @@ class CreateSpreeReimbursementTypes < ActiveRecord::Migration
5
5
  t.boolean :active, default: true
6
6
  t.boolean :mutable, default: true
7
7
 
8
- t.timestamps
8
+ t.timestamps null: false
9
9
  end
10
10
 
11
11
  reversible do |direction|
@@ -0,0 +1,11 @@
1
+ class AddKindToZone < ActiveRecord::Migration
2
+ def change
3
+ add_column :spree_zones, :kind, :string
4
+ add_index :spree_zones, :kind
5
+
6
+ Spree::Zone.find_each do |zone|
7
+ last_type = zone.members.where.not(zoneable_type: nil).pluck(:zoneable_type).last
8
+ zone.update_column :kind, last_type.demodulize.underscore if last_type
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,6 @@
1
+ class RemoveTokenPermissionsTable < ActiveRecord::Migration
2
+ def change
3
+ # The MoveOrderTokenFromTokenizedPermission migration never dropped this.
4
+ drop_table :spree_tokenized_permissions
5
+ end
6
+ end
@@ -0,0 +1,5 @@
1
+ class RemoveExtraProductsSlugIndex < ActiveRecord::Migration
2
+ def change
3
+ remove_index :spree_products, name: :permalink_idx_unique
4
+ end
5
+ end
@@ -0,0 +1,6 @@
1
+ class UpdateProductSlugIndex < ActiveRecord::Migration
2
+ def change
3
+ remove_index :spree_products, :slug
4
+ add_index :spree_products, :slug, unique: true
5
+ end
6
+ end
@@ -0,0 +1,5 @@
1
+ class RenameIdentifierToNumberForPayment < ActiveRecord::Migration
2
+ def change
3
+ rename_column :spree_payments, :identifier, :number
4
+ end
5
+ end
@@ -0,0 +1,6 @@
1
+ class RemoveEnvironmentFromPaymentMethod < ActiveRecord::Migration
2
+ def up
3
+ Spree::PaymentMethod.where('environment != ?', Rails.env).update_all(active: false)
4
+ remove_column :spree_payment_methods, :environment
5
+ end
6
+ end
@@ -0,0 +1,5 @@
1
+ class AddResellableToReturnItems < ActiveRecord::Migration
2
+ def change
3
+ add_column :spree_return_items, :resellable, :boolean, default: true, null: false
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ class AddCodeToSpreePromotionCategories < ActiveRecord::Migration
2
+ def change
3
+ add_column :spree_promotion_categories, :code, :string
4
+ end
5
+ end
@@ -0,0 +1,6 @@
1
+ class RemoveEnvironmentFromTracker < ActiveRecord::Migration
2
+ def up
3
+ Spree::Tracker.where('environment != ?', Rails.env).update_all(active: false)
4
+ remove_column :spree_trackers, :environment
5
+ end
6
+ end
@@ -0,0 +1,16 @@
1
+ class RemoveSpreeConfigurations < ActiveRecord::Migration
2
+ def up
3
+ drop_table "spree_configurations"
4
+ end
5
+
6
+ def down
7
+ create_table "spree_configurations", force: true do |t|
8
+ t.string "name"
9
+ t.string "type", limit: 50
10
+ t.datetime "created_at"
11
+ t.datetime "updated_at"
12
+ end
13
+
14
+ add_index "spree_configurations", ["name", "type"], name: "index_spree_configurations_on_name_and_type"
15
+ end
16
+ end
@@ -8,7 +8,7 @@ Dummy::Application.configure do
8
8
  config.cache_classes = true
9
9
 
10
10
  # Configure static asset server for tests with Cache-Control for performance
11
- config.serve_static_assets = true
11
+ config.serve_static_files = true
12
12
  config.static_cache_control = "public, max-age=3600"
13
13
 
14
14
  # Show full error reports and disable caching
@@ -3,6 +3,10 @@
3
3
  # Note: Initializing preferences available within the Admin will overwrite any changes that were made through the user interface when you restart.
4
4
  # If you would like users to be able to update a setting with the Admin it should NOT be set here.
5
5
  #
6
+ # Note: If a preference is set here it will be stored within the cache & database upon initialization.
7
+ # Just removing an entry from this initializer will not make the preference value go away.
8
+ # Instead you must either set a new value or remove entry, clear cache, and remove database entry.
9
+ #
6
10
  # In order to initialize a setting do:
7
11
  # config.setting_name = 'new value'
8
12
  Spree.config do |config|
@@ -12,7 +12,8 @@ require 'paperclip'
12
12
  require 'paranoia'
13
13
  require 'premailer/rails'
14
14
  require 'ransack'
15
- require 'state_machine'
15
+ require 'responders'
16
+ require 'state_machines-activerecord'
16
17
 
17
18
  module Spree
18
19
 
@@ -64,22 +65,11 @@ require 'spree/permitted_attributes'
64
65
 
65
66
  require 'spree/core/delegate_belongs_to'
66
67
  require 'spree/core/importer'
67
- require 'spree/core/permalinks'
68
68
  require 'spree/core/product_duplicator'
69
69
  require 'spree/core/controller_helpers/auth'
70
70
  require 'spree/core/controller_helpers/common'
71
71
  require 'spree/core/controller_helpers/order'
72
72
  require 'spree/core/controller_helpers/respond_with'
73
73
  require 'spree/core/controller_helpers/search'
74
- require 'spree/core/controller_helpers/ssl'
75
74
  require 'spree/core/controller_helpers/store'
76
75
  require 'spree/core/controller_helpers/strong_parameters'
77
-
78
- # Hack waiting on https://github.com/pluginaweek/state_machine/pull/275
79
- module StateMachine
80
- module Integrations
81
- module ActiveModel
82
- public :around_validation
83
- end
84
- end
85
- end
@@ -3,26 +3,17 @@ require 'spree/responder'
3
3
  module ActionController
4
4
  class Base
5
5
  def respond_with(*resources, &block)
6
- raise "In order to use respond_with, first you need to declare the formats your " <<
7
- "controller responds to in the class level" if self.class.mimes_for_respond_to.empty?
8
-
9
- if collector = retrieve_collector_from_mimes(&block)
10
- options = resources.size == 1 ? {} : resources.extract_options!
11
-
12
- if defined_response = collector.response and !Spree::BaseController.spree_responders.keys.include?(self.class.to_s.to_sym)
13
- if action = options.delete(:action)
14
- render :action => action
15
- else
16
- defined_response.call
17
- end
6
+ if Spree::BaseController.spree_responders.keys.include?(self.class.to_s.to_sym)
7
+ # Checkout AS Array#extract_options! and original respond_with
8
+ # implementation for a better picture of this hack
9
+ if resources.last.is_a? Hash
10
+ resources.last.merge! action_name: action_name.to_sym
18
11
  else
19
- # The action name is needed for processing
20
- options.merge!(:action_name => action_name.to_sym)
21
- # If responder is not specified then pass in Spree::Responder
22
- responder = options.delete(:responder) || self.responder
23
- responder.call(self, resources, options)
12
+ resources.push action_name: action_name.to_sym
24
13
  end
25
14
  end
15
+
16
+ super
26
17
  end
27
18
  end
28
19
  end
@@ -36,7 +27,6 @@ module Spree
36
27
  included do
37
28
  cattr_accessor :spree_responders
38
29
  self.spree_responders = {}
39
-
40
30
  self.responder = Spree::Responder
41
31
  end
42
32
 
@@ -78,6 +78,7 @@ module Spree
78
78
  Spree::Promotion::Rules::UserLoggedIn,
79
79
  Spree::Promotion::Rules::OneUsePerUser,
80
80
  Spree::Promotion::Rules::Taxon,
81
+ Spree::Promotion::Rules::OptionValue
81
82
  ]
82
83
  end
83
84
 
@@ -101,13 +102,6 @@ module Spree
101
102
  initializer "spree.core.checking_migrations" do |app|
102
103
  Migrations.new(config, engine_name).check
103
104
  end
104
-
105
- config.to_prepare do
106
- # Load application's model / class decorators
107
- Dir.glob(File.join(File.dirname(__FILE__), '../../../app/**/*_decorator*.rb')) do |c|
108
- Rails.configuration.cache_classes ? require(c) : load(c)
109
- end
110
- end
111
105
  end
112
106
  end
113
107
  end
@@ -39,7 +39,7 @@ module Spree
39
39
  end
40
40
 
41
41
  def eval_block(&block)
42
- Spree::Core::Engine.routes.eval_block(block)
42
+ Spree::Core::Engine.routes.send :eval_block, block
43
43
  end
44
44
  end
45
45
  end
@@ -1,5 +1,5 @@
1
1
  module Spree
2
2
  def self.version
3
- '2.4.10'
3
+ "3.0.0.rc1"
4
4
  end
5
5
  end
@@ -4,22 +4,22 @@ require 'money'
4
4
 
5
5
  module Spree
6
6
  class Money
7
+ class <<self
8
+ attr_accessor :default_formatting_rules
9
+ end
10
+ self.default_formatting_rules = {
11
+ # Ruby money currently has this as false, which is wrong for the vast
12
+ # majority of locales.
13
+ sign_before_symbol: true
14
+ }
15
+
7
16
  attr_reader :money
8
17
 
9
18
  delegate :cents, to: :money
10
19
 
11
20
  def initialize(amount, options={})
12
21
  @money = Monetize.parse([amount, (options[:currency] || Spree::Config[:currency])].join)
13
- @options = {}
14
- @options[:with_currency] = Spree::Config[:display_currency]
15
- @options[:symbol_position] = Spree::Config[:currency_symbol_position].to_sym
16
- @options[:no_cents] = Spree::Config[:hide_cents]
17
- @options[:decimal_mark] = Spree::Config[:currency_decimal_mark]
18
- @options[:thousands_separator] = Spree::Config[:currency_thousands_separator]
19
- @options[:sign_before_symbol] = Spree::Config[:currency_sign_before_symbol]
20
- @options.merge!(options)
21
- # Must be a symbol because the Money gem doesn't do the conversion
22
- @options[:symbol_position] = @options[:symbol_position].to_sym
22
+ @options = Spree::Money.default_formatting_rules.merge(options)
23
23
  end
24
24
 
25
25
  def to_s
@@ -40,7 +40,7 @@ module Spree
40
40
  :coupon_code, :email, :shipping_method_id, :special_instructions, :use_billing
41
41
  ]
42
42
 
43
- @@customer_return_attributes = [:stock_location_id, return_items_attributes: [:id, :inventory_unit_id, :return_authorization_id, :returned, :pre_tax_amount, :acceptance_status, :exchange_variant_id]]
43
+ @@customer_return_attributes = [:stock_location_id, return_items_attributes: [:id, :inventory_unit_id, :return_authorization_id, :returned, :pre_tax_amount, :acceptance_status, :exchange_variant_id, :resellable]]
44
44
 
45
45
  @@image_attributes = [:alt, :attachment, :position, :viewable_type, :viewable_id]
46
46
 
@@ -61,9 +61,7 @@ module Spree
61
61
  :meta_keywords, :price, :sku, :deleted_at, :prototype_id,
62
62
  :option_values_hash, :weight, :height, :width, :depth,
63
63
  :shipping_category_id, :tax_category_id,
64
- :taxon_ids, :cost_currency, :cost_price,
65
- option_type_ids: []
66
- ]
64
+ :taxon_ids, :option_type_ids, :cost_currency, :cost_price]
67
65
 
68
66
  @@property_attributes = [:name, :presentation]
69
67
 
@@ -103,10 +101,8 @@ module Spree
103
101
 
104
102
  @@variant_attributes = [
105
103
  :name, :presentation, :cost_price, :lock_version,
106
- :position, :track_inventory,
104
+ :position, :option_value_ids, :track_inventory,
107
105
  :product_id, :product, :option_values_attributes, :price,
108
- :weight, :height, :width, :depth, :sku, :cost_currency,
109
- options: [:name, :value], option_value_ids: []
110
- ]
106
+ :weight, :height, :width, :depth, :sku, :cost_currency, options: [ :name, :value ]]
111
107
  end
112
108
  end
@@ -37,9 +37,7 @@ module Spree
37
37
  end
38
38
 
39
39
  before do
40
- allow(Spree.user_class).to receive(:find_by).
41
- with(hash_including(:spree_api_key)).
42
- and_return(Spree.user_class.new)
40
+ allow_any_instance_of(Api::BaseController).to receive(:try_spree_current_user).and_return(Spree.user_class.new)
43
41
  end
44
42
  end
45
43
 
@@ -58,6 +56,6 @@ module Spree
58
56
  end
59
57
 
60
58
  RSpec.configure do |config|
61
- config.extend Spree::TestingSupport::AuthorizationHelpers::Controller, type: :controller
62
- config.extend Spree::TestingSupport::AuthorizationHelpers::Request, type: :feature
59
+ config.extend Spree::TestingSupport::AuthorizationHelpers::Controller, :type => :controller
60
+ config.extend Spree::TestingSupport::AuthorizationHelpers::Request, :type => :feature
63
61
  end
@@ -4,7 +4,7 @@ module CapybaraExt
4
4
  end
5
5
 
6
6
  def click_icon(type)
7
- find(".fa-#{type}").click
7
+ find(".icon-#{type}").click
8
8
  end
9
9
 
10
10
  def eventually_fill_in(field, options={})
@@ -14,9 +14,9 @@ module CapybaraExt
14
14
 
15
15
  def within_row(num, &block)
16
16
  if RSpec.current_example.metadata[:js]
17
- within("table.index tbody tr:nth-child(#{num})", &block)
17
+ within("table.table tbody tr:nth-child(#{num})", &block)
18
18
  else
19
- within(:xpath, all("table.index tbody tr")[num-1].path, &block)
19
+ within(:xpath, all("table.table tbody tr")[num-1].path, &block)
20
20
  end
21
21
  end
22
22