spree_core 2.0.3 → 2.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/assets/images/logo/spree_50.png +0 -0
- data/app/assets/images/noimage/large.png +0 -0
- data/app/assets/images/noimage/mini.png +0 -0
- data/app/assets/images/noimage/product.png +0 -0
- data/app/assets/images/noimage/small.png +0 -0
- data/app/controllers/spree/base_controller.rb +3 -0
- data/app/helpers/spree/base_helper.rb +15 -11
- data/app/models/spree/adjustment.rb +5 -0
- data/app/models/spree/app_configuration.rb +3 -3
- data/app/models/spree/calculator/default_tax.rb +2 -2
- data/app/models/spree/calculator/percent_per_item.rb +9 -5
- data/app/models/spree/calculator.rb +1 -1
- data/app/models/spree/credit_card.rb +25 -0
- data/app/models/spree/line_item.rb +9 -0
- data/app/models/spree/new_adjustment.rb +4 -0
- data/app/models/spree/order/checkout.rb +4 -5
- data/app/models/spree/order.rb +52 -25
- data/app/models/spree/order_contents.rb +8 -7
- data/app/models/spree/order_inventory.rb +13 -13
- data/app/models/spree/order_populator.rb +4 -14
- data/app/models/spree/order_updater.rb +1 -1
- data/app/models/spree/payment/processing.rb +5 -0
- data/app/models/spree/payment.rb +12 -1
- data/app/models/spree/payment_method.rb +1 -4
- data/app/models/spree/product.rb +44 -17
- data/app/models/spree/promotion/actions/create_adjustment.rb +1 -1
- data/app/models/spree/promotion/actions/create_line_items.rb +32 -2
- data/app/models/spree/promotion.rb +2 -1
- data/app/models/spree/shipment.rb +5 -5
- data/app/models/spree/shipping_adjustment.rb +4 -0
- data/app/models/spree/shipping_method.rb +6 -0
- data/app/models/spree/shipping_rate.rb +1 -0
- data/app/models/spree/stock/availability_validator.rb +5 -3
- data/app/models/spree/stock/coordinator.rb +16 -4
- data/app/models/spree/stock/estimator.rb +16 -6
- data/app/models/spree/stock/packer.rb +2 -1
- data/app/models/spree/stock_location.rb +16 -6
- data/app/models/spree/tax_category.rb +1 -7
- data/app/models/spree/tax_rate.rb +1 -0
- data/app/models/spree/variant.rb +16 -3
- data/app/models/spree/zone.rb +1 -1
- data/config/initializers/user_class_extensions.rb +1 -1
- data/config/locales/en.yml +15 -1
- data/db/migrate/20130228210442_create_shipping_method_zone.rb +6 -1
- data/db/migrate/20130306181701_add_address_fields_to_stock_location.rb +4 -1
- data/db/migrate/20130515180736_add_backorderable_default_to_spree_stock_location.rb +5 -0
- data/db/migrate/20130516151222_add_propage_all_variants_to_spree_stock_location.rb +5 -0
- data/db/migrate/20130626232741_add_cvv_result_code_and_cvv_result_message_to_spree_payments.rb +6 -0
- data/db/migrate/20130628021056_add_unique_index_to_permalink_on_spree_products.rb +5 -0
- data/db/migrate/20130628022817_add_unique_index_to_orders_shipments_and_stock_transfers.rb +7 -0
- data/db/migrate/20130708052307_add_deleted_at_to_spree_tax_rates.rb +5 -0
- data/db/migrate/20130711200933_remove_lock_version_from_inventory_units.rb +6 -0
- data/db/migrate/20130718042445_add_cost_price_to_line_item.rb +5 -0
- data/db/migrate/20130718233855_set_backorderable_to_default_to_false.rb +6 -0
- data/db/migrate/20130725031716_add_created_by_id_to_spree_orders.rb +5 -0
- data/db/migrate/20130729214043_index_completed_at_on_spree_orders.rb +5 -0
- data/db/migrate/20130802014537_add_tax_category_id_to_spree_line_items.rb +5 -0
- data/db/migrate/20130802022321_migrate_tax_categories_to_line_items.rb +9 -0
- data/db/migrate/20130805043440_create_spree_new_adjustments.rb +8 -0
- data/lib/generators/spree/dummy/templates/rails/database.yml +8 -7
- data/lib/generators/spree/install/install_generator.rb +1 -1
- data/lib/spree/core/calculated_adjustments.rb +12 -1
- data/lib/spree/core/controller_helpers/order.rb +5 -3
- data/lib/spree/core/controller_helpers/search.rb +14 -0
- data/lib/spree/core/permalinks.rb +13 -13
- data/lib/spree/core/s3_support.rb +1 -1
- data/lib/spree/core/version.rb +1 -1
- data/lib/spree/core.rb +7 -5
- data/lib/spree/i18n/base.rb +17 -0
- data/lib/spree/i18n/initializer.rb +1 -0
- data/lib/spree/i18n.rb +28 -7
- data/lib/spree/money.rb +2 -0
- data/lib/spree/testing_support/authorization_helpers.rb +6 -15
- data/lib/spree/testing_support/capybara_ext.rb +20 -11
- data/lib/spree/testing_support/common_rake.rb +13 -0
- data/lib/spree/testing_support/factories/country_factory.rb +1 -1
- data/lib/spree/testing_support/factories/order_factory.rb +0 -2
- data/lib/spree/testing_support/factories/payment_method_factory.rb +1 -1
- data/lib/spree/testing_support/factories/product_factory.rb +8 -18
- data/lib/spree/testing_support/factories/return_authorization_factory.rb +4 -0
- data/lib/spree/testing_support/factories/shipment_factory.rb +1 -1
- data/lib/spree/testing_support/factories/stock_item_factory.rb +2 -1
- data/lib/spree/testing_support/factories/stock_location_factory.rb +5 -2
- data/lib/spree/testing_support/factories/variant_factory.rb +1 -1
- data/lib/spree/testing_support/order_walkthrough.rb +14 -1
- data/vendor/assets/javascripts/jquery.validate/localization/messages_et.js +23 -0
- data/vendor/assets/javascripts/jquery.validate/localization/messages_eu.js +25 -0
- data/vendor/assets/javascripts/jquery.validate/localization/messages_hr.js +25 -0
- data/vendor/assets/javascripts/jquery.validate/localization/messages_ka.js +25 -0
- data/vendor/assets/javascripts/jquery.validate/localization/messages_ko.js +25 -0
- data/vendor/assets/javascripts/jquery.validate/localization/messages_my.js +25 -0
- data/vendor/assets/javascripts/jquery.validate/localization/messages_pt_BR.js +26 -0
- data/vendor/assets/javascripts/jquery.validate/localization/messages_pt_PT.js +26 -0
- data/vendor/assets/javascripts/jquery.validate/localization/messages_sl.js +25 -0
- data/vendor/assets/javascripts/jquery.validate/localization/messages_sv.js +23 -0
- data/vendor/assets/javascripts/jquery.validate/localization/messages_uk.js +25 -0
- data/vendor/assets/javascripts/jquery.validate/localization/messages_zh.js +25 -0
- data/vendor/assets/javascripts/jquery.validate/localization/messages_zh_TW.js +26 -0
- metadata +118 -67
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
class MigrateTaxCategoriesToLineItems < ActiveRecord::Migration
|
|
2
|
+
def change
|
|
3
|
+
Spree::LineItem.includes(:variant => { :product => :tax_category }).find_in_batches do |line_items|
|
|
4
|
+
line_items.each do |line_item|
|
|
5
|
+
line_item.update_column(:tax_category_id, line_item.product.tax_category.id)
|
|
6
|
+
end
|
|
7
|
+
end
|
|
8
|
+
end
|
|
9
|
+
end
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
<% if agent_number = ENV['TC_AGENT_NUMBER']
|
|
2
|
-
database_prefix = agent_number +
|
|
2
|
+
database_prefix = agent_number + '_'
|
|
3
3
|
end %>
|
|
4
4
|
<% case ENV['DB']
|
|
5
5
|
when 'sqlite' %>
|
|
6
6
|
development:
|
|
7
7
|
adapter: sqlite3
|
|
8
|
-
database:
|
|
8
|
+
database: db/spree_development.sqlite3
|
|
9
9
|
test:
|
|
10
10
|
adapter: sqlite3
|
|
11
|
-
database:
|
|
11
|
+
database: db/spree_test.sqlite3
|
|
12
|
+
timeout: 10000
|
|
12
13
|
production:
|
|
13
14
|
adapter: sqlite3
|
|
14
|
-
database:
|
|
15
|
+
database: db/spree_production.sqlite3
|
|
15
16
|
<% when 'mysql' %>
|
|
16
17
|
development:
|
|
17
18
|
adapter: mysql2
|
|
@@ -47,11 +48,11 @@ production:
|
|
|
47
48
|
<% else %>
|
|
48
49
|
development:
|
|
49
50
|
adapter: sqlite3
|
|
50
|
-
database:
|
|
51
|
+
database: db/spree_development.sqlite3
|
|
51
52
|
test:
|
|
52
53
|
adapter: sqlite3
|
|
53
|
-
database:
|
|
54
|
+
database: db/spree_test.sqlite3
|
|
54
55
|
production:
|
|
55
56
|
adapter: sqlite3
|
|
56
|
-
database:
|
|
57
|
+
database: db/spree_production.sqlite3
|
|
57
58
|
<% end %>
|
|
@@ -100,7 +100,7 @@ Disallow: /account
|
|
|
100
100
|
end
|
|
101
101
|
APP
|
|
102
102
|
|
|
103
|
-
append_file "config/environment.rb", "\nActiveRecord::Base.include_root_in_json =
|
|
103
|
+
append_file "config/environment.rb", "\nActiveRecord::Base.include_root_in_json = false\n"
|
|
104
104
|
end
|
|
105
105
|
|
|
106
106
|
def include_seed_data
|
|
@@ -25,10 +25,16 @@ module Spree
|
|
|
25
25
|
# sets amount based on the calculator as applied to the calculable argument (Order, LineItems[], Shipment, etc.)
|
|
26
26
|
# By default the adjustment will not be considered mandatory
|
|
27
27
|
def create_adjustment(label, target, calculable, mandatory=false, state="closed")
|
|
28
|
+
# Adjustment calculations done on Spree::Shipment objects MUST
|
|
29
|
+
# be done on their to_package'd variants instead
|
|
30
|
+
# It's only the package that contains the correct information.
|
|
31
|
+
# See https://github.com/spree/spree_active_shipping/pull/96 et. al
|
|
32
|
+
old_calculable = calculable
|
|
33
|
+
calculable = calculable.to_package if calculable.is_a?(Spree::Shipment)
|
|
28
34
|
amount = compute_amount(calculable)
|
|
29
35
|
return if amount == 0 && !mandatory
|
|
30
36
|
target.adjustments.create({ :amount => amount,
|
|
31
|
-
:source =>
|
|
37
|
+
:source => old_calculable,
|
|
32
38
|
:originator => self,
|
|
33
39
|
:label => label,
|
|
34
40
|
:mandatory => mandatory,
|
|
@@ -38,6 +44,11 @@ module Spree
|
|
|
38
44
|
# Updates the amount of the adjustment using our Calculator and calling the +compute+ method with the +calculable+
|
|
39
45
|
# referenced passed to the method.
|
|
40
46
|
def update_adjustment(adjustment, calculable)
|
|
47
|
+
# Adjustment calculations done on Spree::Shipment objects MUST
|
|
48
|
+
# be done on their to_package'd variants instead
|
|
49
|
+
# It's only the package that contains the correct information.
|
|
50
|
+
# See https://github.com/spree/spree_active_shipping/pull/96 et. al
|
|
51
|
+
calculable = calculable.to_package if calculable.is_a?(Spree::Shipment)
|
|
41
52
|
adjustment.update_attribute_without_callbacks(:amount, compute_amount(calculable))
|
|
42
53
|
end
|
|
43
54
|
|
|
@@ -20,6 +20,8 @@ module Spree
|
|
|
20
20
|
if create_order_if_necessary and (@current_order.nil? or @current_order.completed?)
|
|
21
21
|
@current_order = Spree::Order.new(:currency => current_currency)
|
|
22
22
|
@current_order.user ||= try_spree_current_user
|
|
23
|
+
# See issue #3346 for reasons why this line is here
|
|
24
|
+
@current_order.created_by ||= try_spree_current_user
|
|
23
25
|
@current_order.save!
|
|
24
26
|
|
|
25
27
|
# make sure the user has permission to access the order (if they are a guest)
|
|
@@ -45,12 +47,12 @@ module Spree
|
|
|
45
47
|
# This will trigger any "first order" promotions to be triggered
|
|
46
48
|
# Assuming of course that this session variable was set correctly in
|
|
47
49
|
# the authentication provider's registrations controller
|
|
48
|
-
if session[:spree_user_signup]
|
|
49
|
-
fire_event('spree.user.signup', :user => try_spree_current_user, :order =>
|
|
50
|
+
if session[:spree_user_signup] && @order
|
|
51
|
+
fire_event('spree.user.signup', :user => try_spree_current_user, :order => @order)
|
|
52
|
+
session[:spree_user_signup] = nil
|
|
50
53
|
end
|
|
51
54
|
|
|
52
55
|
session[:guest_token] = nil
|
|
53
|
-
session[:spree_user_signup] = nil
|
|
54
56
|
end
|
|
55
57
|
|
|
56
58
|
def set_current_order
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
module Spree
|
|
2
|
+
module Core
|
|
3
|
+
module ControllerHelpers
|
|
4
|
+
module Search
|
|
5
|
+
def build_searcher params
|
|
6
|
+
Spree::Config.searcher_class.new(params).tap do |searcher|
|
|
7
|
+
searcher.current_user = try_spree_current_user
|
|
8
|
+
searcher.current_currency = current_currency
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -14,8 +14,6 @@ module Spree
|
|
|
14
14
|
options[:field] ||= :permalink
|
|
15
15
|
self.permalink_options = options
|
|
16
16
|
|
|
17
|
-
validates permalink_options[:field], :uniqueness => true
|
|
18
|
-
|
|
19
17
|
if self.table_exists? && self.column_names.include?(permalink_options[:field].to_s)
|
|
20
18
|
before_validation(:on => :create) { save_permalink }
|
|
21
19
|
end
|
|
@@ -48,18 +46,20 @@ module Spree
|
|
|
48
46
|
end
|
|
49
47
|
|
|
50
48
|
def save_permalink(permalink_value=self.to_param)
|
|
51
|
-
|
|
49
|
+
self.with_lock do
|
|
50
|
+
permalink_value ||= generate_permalink
|
|
52
51
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
52
|
+
field = self.class.permalink_field
|
|
53
|
+
# Do other links exist with this permalink?
|
|
54
|
+
other = self.class.where("#{self.class.table_name}.#{field} LIKE ?", "#{permalink_value}%")
|
|
55
|
+
if other.any?
|
|
56
|
+
# Find the existing permalink with the highest number, and increment that number.
|
|
57
|
+
# (If none of the existing permalinks have a number, this will evaluate to 1.)
|
|
58
|
+
number = other.map { |o| o.send(field)[/-(\d+)$/, 1].to_i }.max + 1
|
|
59
|
+
permalink_value += "-#{number.to_s}"
|
|
60
|
+
end
|
|
61
|
+
write_attribute(field, permalink_value)
|
|
62
|
+
end
|
|
63
63
|
end
|
|
64
64
|
end
|
|
65
65
|
end
|
|
@@ -15,7 +15,7 @@ module Spree
|
|
|
15
15
|
self.attachment_definitions[field][:s3_credentials] = s3_creds
|
|
16
16
|
self.attachment_definitions[field][:s3_headers] = ActiveSupport::JSON.decode(config[:s3_headers])
|
|
17
17
|
self.attachment_definitions[field][:bucket] = config[:s3_bucket]
|
|
18
|
-
self.attachment_definitions[field][:s3_protocol] = config[:s3_protocol] unless config[:s3_protocol].blank?
|
|
18
|
+
self.attachment_definitions[field][:s3_protocol] = config[:s3_protocol].downcase unless config[:s3_protocol].blank?
|
|
19
19
|
self.attachment_definitions[field][:s3_host_alias] = config[:s3_host_alias] unless config[:s3_host_alias].blank?
|
|
20
20
|
end
|
|
21
21
|
end
|
data/lib/spree/core/version.rb
CHANGED
data/lib/spree/core.rb
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
require 'rails/all'
|
|
2
|
+
require 'active_merchant'
|
|
3
|
+
require 'acts_as_list'
|
|
4
|
+
require 'awesome_nested_set'
|
|
2
5
|
require 'cancan'
|
|
3
|
-
require 'state_machine'
|
|
4
|
-
require 'paperclip'
|
|
5
6
|
require 'kaminari'
|
|
6
|
-
require '
|
|
7
|
-
require '
|
|
8
|
-
require '
|
|
7
|
+
require 'mail'
|
|
8
|
+
require 'paperclip'
|
|
9
|
+
require 'paranoia'
|
|
9
10
|
require 'ransack'
|
|
11
|
+
require 'state_machine'
|
|
10
12
|
|
|
11
13
|
module Spree
|
|
12
14
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Spree::BaseController.send(:include, Spree::ViewContext)
|
data/lib/spree/i18n.rb
CHANGED
|
@@ -1,15 +1,36 @@
|
|
|
1
1
|
require 'i18n'
|
|
2
2
|
require 'active_support/core_ext/array/extract_options'
|
|
3
|
+
require 'spree/i18n/base'
|
|
3
4
|
|
|
4
5
|
module Spree
|
|
5
6
|
extend ActionView::Helpers::TranslationHelper
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
class << self
|
|
9
|
+
# Add spree namespace and delegate to Rails TranslationHelper for some nice
|
|
10
|
+
# extra functionality. e.g return reasonable strings for missing translations
|
|
11
|
+
def translate(*args)
|
|
12
|
+
@virtual_path = virtual_path
|
|
13
|
+
|
|
14
|
+
options = args.extract_options!
|
|
15
|
+
options[:scope] = [*options[:scope]].unshift(:spree)
|
|
16
|
+
args << options
|
|
17
|
+
super(*args)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
alias_method :t, :translate
|
|
21
|
+
|
|
22
|
+
def context
|
|
23
|
+
Spree::ViewContext.context
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def virtual_path
|
|
27
|
+
if context
|
|
28
|
+
path = context.instance_variable_get("@virtual_path")
|
|
29
|
+
|
|
30
|
+
if path
|
|
31
|
+
path.gsub(/spree/, '')
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
14
35
|
end
|
|
15
36
|
end
|
data/lib/spree/money.rb
CHANGED
|
@@ -10,17 +10,6 @@ module Spree
|
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
module Request
|
|
13
|
-
class BarAbility
|
|
14
|
-
include CanCan::Ability
|
|
15
|
-
|
|
16
|
-
def initialize(user)
|
|
17
|
-
# allow dispatch to :admin, :index, and :edit on Spree::Order
|
|
18
|
-
can [:admin, :edit, :index, :read], Spree::Order
|
|
19
|
-
# allow dispatch to :index, :show, :create and :update shipments on the admin
|
|
20
|
-
can [:admin, :manage, :read, :ship], Spree::Shipment
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
|
|
24
13
|
class SuperAbility
|
|
25
14
|
include CanCan::Ability
|
|
26
15
|
|
|
@@ -41,13 +30,15 @@ module Spree
|
|
|
41
30
|
end
|
|
42
31
|
end
|
|
43
32
|
|
|
44
|
-
def
|
|
33
|
+
def custom_authorization!(&block)
|
|
34
|
+
ability = Class.new do
|
|
35
|
+
include CanCan::Ability
|
|
36
|
+
define_method(:initialize, block)
|
|
37
|
+
end
|
|
45
38
|
after(:all) do
|
|
46
|
-
ability = Spree::TestingSupport::AuthorizationHelpers::Request::BarAbility
|
|
47
39
|
Spree::Ability.remove_ability(ability)
|
|
48
40
|
end
|
|
49
41
|
before(:all) do
|
|
50
|
-
ability = Spree::TestingSupport::AuthorizationHelpers::Request::BarAbility
|
|
51
42
|
Spree::Ability.register_ability(ability)
|
|
52
43
|
end
|
|
53
44
|
end
|
|
@@ -58,5 +49,5 @@ end
|
|
|
58
49
|
|
|
59
50
|
RSpec.configure do |config|
|
|
60
51
|
config.extend Spree::TestingSupport::AuthorizationHelpers::Controller, :type => :controller
|
|
61
|
-
config.extend Spree::TestingSupport::AuthorizationHelpers::Request, :type => :
|
|
52
|
+
config.extend Spree::TestingSupport::AuthorizationHelpers::Request, :type => :feature
|
|
62
53
|
end
|
|
@@ -8,9 +8,7 @@ module CapybaraExt
|
|
|
8
8
|
end
|
|
9
9
|
|
|
10
10
|
def eventually_fill_in(field, options={})
|
|
11
|
-
|
|
12
|
-
find_field field
|
|
13
|
-
end
|
|
11
|
+
page.should have_css('#' + field)
|
|
14
12
|
fill_in field, options
|
|
15
13
|
end
|
|
16
14
|
|
|
@@ -27,9 +25,11 @@ module CapybaraExt
|
|
|
27
25
|
end
|
|
28
26
|
|
|
29
27
|
def select2_search(value, options)
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
28
|
+
label = find_label_by_text(options[:from])
|
|
29
|
+
within label.first(:xpath,".//..") do
|
|
30
|
+
options[:from] = "##{find(".select2-container")["id"]}"
|
|
31
|
+
targetted_select2_search(value, options)
|
|
32
|
+
end
|
|
33
33
|
end
|
|
34
34
|
|
|
35
35
|
def targetted_select2_search(value, options)
|
|
@@ -39,11 +39,12 @@ module CapybaraExt
|
|
|
39
39
|
end
|
|
40
40
|
|
|
41
41
|
def select2(value, options)
|
|
42
|
-
|
|
42
|
+
label = find_label_by_text(options[:from])
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
within label.first(:xpath,".//..") do
|
|
45
|
+
options[:from] = "##{find(".select2-container")["id"]}"
|
|
46
|
+
targetted_select2(value, options)
|
|
47
|
+
end
|
|
47
48
|
end
|
|
48
49
|
|
|
49
50
|
def select2_no_label value, options={}
|
|
@@ -84,13 +85,21 @@ module CapybaraExt
|
|
|
84
85
|
raise "Could not find label by text #{text}"
|
|
85
86
|
end
|
|
86
87
|
|
|
87
|
-
label
|
|
88
|
+
label
|
|
88
89
|
end
|
|
89
90
|
|
|
90
91
|
def find_label(text)
|
|
91
92
|
first(:xpath, "//label[text()[contains(.,'#{text}')]]")
|
|
92
93
|
end
|
|
93
94
|
|
|
95
|
+
def wait_for_ajax
|
|
96
|
+
counter = 0
|
|
97
|
+
while page.execute_script("return $.active").to_i > 0
|
|
98
|
+
counter += 1
|
|
99
|
+
sleep(0.1)
|
|
100
|
+
raise "AJAX request took longer than 5 seconds." if counter >= 50
|
|
101
|
+
end
|
|
102
|
+
end
|
|
94
103
|
end
|
|
95
104
|
|
|
96
105
|
RSpec::Matchers.define :have_meta do |name, expected|
|
|
@@ -32,4 +32,17 @@ namespace :common do
|
|
|
32
32
|
puts 'Skipping installation no generator to run...'
|
|
33
33
|
end
|
|
34
34
|
end
|
|
35
|
+
|
|
36
|
+
task :seed do |t, args|
|
|
37
|
+
puts "Seeding ..."
|
|
38
|
+
cmd = "bundle exec rake db:seed RAILS_ENV=test"
|
|
39
|
+
|
|
40
|
+
if RUBY_PLATFORM =~ /mswin/ #windows
|
|
41
|
+
cmd += " >nul"
|
|
42
|
+
else
|
|
43
|
+
cmd += " >/dev/null"
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
system(cmd)
|
|
47
|
+
end
|
|
35
48
|
end
|
|
@@ -11,7 +11,7 @@ FactoryGirl.define do
|
|
|
11
11
|
|
|
12
12
|
# authorize.net was moved to spree_gateway.
|
|
13
13
|
# Leaving this factory in place with bogus in case anyone is using it.
|
|
14
|
-
factory :
|
|
14
|
+
factory :bogus_simple_payment_method, class: Spree::Gateway::BogusSimple do
|
|
15
15
|
name 'Credit Card'
|
|
16
16
|
environment 'test'
|
|
17
17
|
end
|
|
@@ -7,34 +7,24 @@ FactoryGirl.define do
|
|
|
7
7
|
sku 'ABC'
|
|
8
8
|
available_on { 1.year.ago }
|
|
9
9
|
deleted_at nil
|
|
10
|
+
shipping_category { |r| Spree::ShippingCategory.first || r.association(:shipping_category) }
|
|
10
11
|
|
|
11
12
|
# ensure stock item will be created for this products master
|
|
12
13
|
before(:create) { create(:stock_location) if Spree::StockLocation.count == 0 }
|
|
13
14
|
|
|
15
|
+
factory :custom_product do
|
|
16
|
+
name 'Custom Product'
|
|
17
|
+
price 17.99
|
|
18
|
+
|
|
19
|
+
tax_category { |r| Spree::TaxCategory.first || r.association(:tax_category) }
|
|
20
|
+
end
|
|
21
|
+
|
|
14
22
|
factory :product do
|
|
15
23
|
tax_category { |r| Spree::TaxCategory.first || r.association(:tax_category) }
|
|
16
|
-
shipping_category { |r| Spree::ShippingCategory.first || r.association(:shipping_category) }
|
|
17
24
|
|
|
18
25
|
factory :product_with_option_types do
|
|
19
26
|
after(:create) { |product| create(:product_option_type, product: product) }
|
|
20
27
|
end
|
|
21
28
|
end
|
|
22
29
|
end
|
|
23
|
-
|
|
24
|
-
factory :custom_product, class: Spree::Product do
|
|
25
|
-
name 'Custom Product'
|
|
26
|
-
description { generate(:random_description) }
|
|
27
|
-
price 17.99
|
|
28
|
-
sku 'ABC'
|
|
29
|
-
available_on { 1.year.ago }
|
|
30
|
-
deleted_at nil
|
|
31
|
-
|
|
32
|
-
tax_category { |r| Spree::TaxCategory.first || r.association(:tax_category) }
|
|
33
|
-
shipping_category { |r| Spree::ShippingCategory.first || r.association(:shipping_category) }
|
|
34
|
-
|
|
35
|
-
# association :taxons
|
|
36
|
-
|
|
37
|
-
# ensure stock item will be created for this products master
|
|
38
|
-
before(:create) { create(:stock_location) if Spree::StockLocation.count == 0 }
|
|
39
|
-
end
|
|
40
30
|
end
|
|
@@ -12,7 +12,7 @@ FactoryGirl.define do
|
|
|
12
12
|
shipment.add_shipping_method(create(:shipping_method), true)
|
|
13
13
|
|
|
14
14
|
shipment.order.line_items.each do |line_item|
|
|
15
|
-
line_item.quantity.times { shipment.inventory_units.create(variant_id: line_item.
|
|
15
|
+
line_item.quantity.times { shipment.inventory_units.create(variant_id: line_item.variant_id) }
|
|
16
16
|
end
|
|
17
17
|
end
|
|
18
18
|
end
|
|
@@ -6,9 +6,12 @@ FactoryGirl.define do
|
|
|
6
6
|
zipcode '20500'
|
|
7
7
|
phone '(202) 456-1111'
|
|
8
8
|
active true
|
|
9
|
+
backorderable_default true
|
|
9
10
|
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
country { |stock_location| Spree::Country.first || stock_location.association(:country) }
|
|
12
|
+
state do |stock_location|
|
|
13
|
+
stock_location.country.states.first || stock_location.association(:state, :country => stock_location.country)
|
|
14
|
+
end
|
|
12
15
|
|
|
13
16
|
factory :stock_location_with_items do
|
|
14
17
|
after(:create) do |stock_location, evaluator|
|
|
@@ -4,7 +4,7 @@ FactoryGirl.define do
|
|
|
4
4
|
factory :base_variant, class: Spree::Variant do
|
|
5
5
|
price 19.99
|
|
6
6
|
cost_price 17.00
|
|
7
|
-
sku {
|
|
7
|
+
sku { SecureRandom.hex }
|
|
8
8
|
weight { generate(:random_float) }
|
|
9
9
|
height { generate(:random_float) }
|
|
10
10
|
width { generate(:random_float) }
|
|
@@ -5,7 +5,20 @@ class OrderWalkthrough
|
|
|
5
5
|
FactoryGirl.create(:payment_method)
|
|
6
6
|
end
|
|
7
7
|
|
|
8
|
-
#
|
|
8
|
+
# Need to create a valid zone too...
|
|
9
|
+
zone = FactoryGirl.create(:zone)
|
|
10
|
+
country = FactoryGirl.create(:country)
|
|
11
|
+
zone.members << Spree::ZoneMember.create(:zoneable => country)
|
|
12
|
+
country.states << FactoryGirl.create(:state, :country => country)
|
|
13
|
+
|
|
14
|
+
# A shipping method must exist for rates to be displayed on checkout page
|
|
15
|
+
unless Spree::ShippingMethod.exists?
|
|
16
|
+
FactoryGirl.create(:shipping_method).tap do |sm|
|
|
17
|
+
sm.calculator.preferred_amount = 10
|
|
18
|
+
sm.calculator.preferred_currency = Spree::Config[:currency]
|
|
19
|
+
sm.calculator.save
|
|
20
|
+
end
|
|
21
|
+
end
|
|
9
22
|
|
|
10
23
|
order = Spree::Order.create!(:email => "spree@example.com")
|
|
11
24
|
add_line_item!(order)
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Translated default messages for the jQuery validation plugin.
|
|
3
|
+
* Locale: ET (Estonian; eesti, eesti keel)
|
|
4
|
+
*/
|
|
5
|
+
(function ($) {
|
|
6
|
+
$.extend($.validator.messages, {
|
|
7
|
+
required: "See väli peab olema täidetud.",
|
|
8
|
+
maxlength: $.validator.format("Palun sisestage vähem kui {0} tähemärki."),
|
|
9
|
+
minlength: $.validator.format("Palun sisestage vähemalt {0} tähemärki."),
|
|
10
|
+
rangelength: $.validator.format("Palun sisestage väärtus vahemikus {0} kuni {1} tähemärki."),
|
|
11
|
+
email: "Palun sisestage korrektne e-maili aadress.",
|
|
12
|
+
url: "Palun sisestage korrektne URL.",
|
|
13
|
+
date: "Palun sisestage korrektne kuupäev.",
|
|
14
|
+
dateISO: "Palun sisestage korrektne kuupäev (YYYY-MM-DD).",
|
|
15
|
+
number: "Palun sisestage korrektne number.",
|
|
16
|
+
digits: "Palun sisestage ainult numbreid.",
|
|
17
|
+
equalTo: "Palun sisestage sama väärtus uuesti.",
|
|
18
|
+
range: $.validator.format("Palun sisestage väärtus vahemikus {0} kuni {1}."),
|
|
19
|
+
max: $.validator.format("Palun sisestage väärtus, mis on väiksem või võrdne arvuga {0}."),
|
|
20
|
+
min: $.validator.format("Palun sisestage väärtus, mis on suurem või võrdne arvuga {0}."),
|
|
21
|
+
creditcard: "Palun sisestage korrektne krediitkaardi number."
|
|
22
|
+
});
|
|
23
|
+
}(jQuery));
|