spree_core 2.0.13 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/spree/base_controller.rb +3 -0
- data/app/helpers/spree/base_helper.rb +6 -16
- data/app/helpers/spree/products_helper.rb +3 -8
- data/app/helpers/spree/taxons_helper.rb +1 -1
- data/app/mailers/spree/base_mailer.rb +0 -5
- data/app/models/spree/ability.rb +10 -7
- data/app/models/spree/address.rb +7 -17
- data/app/models/spree/adjustment.rb +15 -11
- data/app/models/spree/app_configuration.rb +0 -5
- data/app/models/spree/billing_integration.rb +0 -1
- data/app/models/spree/calculator/flat_percent_item_total.rb +1 -3
- data/app/models/spree/calculator/flat_rate.rb +2 -4
- data/app/models/spree/calculator/flexi_rate.rb +6 -9
- data/app/models/spree/calculator/per_item.rb +2 -4
- data/app/models/spree/calculator/percent_per_item.rb +1 -3
- data/app/models/spree/calculator/price_sack.rb +4 -9
- data/app/models/spree/calculator/shipping/flat_percent_item_total.rb +1 -2
- data/app/models/spree/calculator/shipping/flat_rate.rb +2 -4
- data/app/models/spree/calculator/shipping/flexi_rate.rb +4 -9
- data/app/models/spree/calculator/shipping/per_item.rb +2 -3
- data/app/models/spree/calculator/shipping/price_sack.rb +4 -9
- data/app/models/spree/classification.rb +0 -3
- data/app/models/spree/country.rb +1 -3
- data/app/models/spree/credit_card.rb +37 -38
- data/app/models/spree/gateway/bogus_simple.rb +0 -8
- data/app/models/spree/gateway.rb +1 -3
- data/app/models/spree/image.rb +1 -3
- data/app/models/spree/inventory_unit.rb +5 -8
- data/app/models/spree/legacy_user.rb +0 -4
- data/app/models/spree/line_item.rb +2 -15
- data/app/models/spree/option_type.rb +2 -5
- data/app/models/spree/option_value.rb +1 -3
- data/app/models/spree/order/checkout.rb +4 -13
- data/app/models/spree/order.rb +47 -99
- data/app/models/spree/order_contents.rb +4 -7
- data/app/models/spree/order_inventory.rb +4 -8
- data/app/models/spree/order_updater.rb +13 -12
- data/app/models/spree/payment/processing.rb +12 -19
- data/app/models/spree/payment.rb +17 -30
- data/app/models/spree/payment_method.rb +2 -3
- data/app/models/spree/preference.rb +1 -1
- data/app/models/spree/preferences/configuration.rb +1 -1
- data/app/models/spree/preferences/preferable.rb +1 -1
- data/app/models/spree/preferences/store.rb +1 -1
- data/app/models/spree/price.rb +0 -7
- data/app/models/spree/product/scopes.rb +16 -17
- data/app/models/spree/product.rb +27 -62
- data/app/models/spree/product_property.rb +3 -5
- data/app/models/spree/promotion/actions/create_adjustment.rb +9 -8
- data/app/models/spree/promotion/actions/create_line_items.rb +1 -2
- data/app/models/spree/promotion/rules/first_order.rb +1 -1
- data/app/models/spree/promotion/rules/item_total.rb +2 -4
- data/app/models/spree/promotion/rules/product.rb +2 -2
- data/app/models/spree/promotion/rules/user.rb +1 -3
- data/app/models/spree/promotion.rb +23 -24
- data/app/models/spree/promotion_action.rb +0 -2
- data/app/models/spree/promotion_action_line_item.rb +1 -3
- data/app/models/spree/promotion_rule.rb +0 -2
- data/app/models/spree/property.rb +2 -4
- data/app/models/spree/prototype.rb +0 -2
- data/app/models/spree/return_authorization.rb +6 -9
- data/app/models/spree/role.rb +0 -2
- data/app/models/spree/shipment.rb +19 -25
- data/app/models/spree/shipping_calculator.rb +0 -2
- data/app/models/spree/shipping_category.rb +0 -2
- data/app/models/spree/shipping_method.rb +6 -20
- data/app/models/spree/shipping_rate.rb +12 -10
- data/app/models/spree/state.rb +2 -4
- data/app/models/spree/stock/availability_validator.rb +2 -2
- data/app/models/spree/stock/estimator.rb +6 -20
- data/app/models/spree/stock/packer.rb +1 -1
- data/app/models/spree/stock/quantifier.rb +2 -3
- data/app/models/spree/stock/splitter/base.rb +1 -1
- data/app/models/spree/stock_item.rb +8 -18
- data/app/models/spree/stock_location.rb +2 -11
- data/app/models/spree/stock_movement.rb +2 -5
- data/app/models/spree/stock_transfer.rb +0 -2
- data/app/models/spree/tax_category.rb +0 -2
- data/app/models/spree/tax_rate.rb +12 -12
- data/app/models/spree/taxon.rb +1 -13
- data/app/models/spree/taxonomy.rb +3 -6
- data/app/models/spree/tracker.rb +0 -2
- data/app/models/spree/variant/scopes.rb +2 -2
- data/app/models/spree/variant.rb +13 -31
- data/app/models/spree/zone.rb +2 -7
- data/app/models/spree/zone_member.rb +0 -2
- data/app/views/spree/payments/_payment.html.erb +1 -3
- data/config/locales/en.yml +11 -26
- data/db/default/spree/countries.rb +230 -229
- data/db/default/spree/states.rb +57 -56
- data/db/default/spree/zones.rb +5 -5
- data/db/migrate/20130213191427_create_default_stock.rb +4 -7
- data/db/migrate/20130417120035_update_adjustment_states.rb +2 -2
- data/db/migrate/20130417123427_add_shipping_rates_to_shipments.rb +1 -1
- data/db/migrate/20130509115210_add_number_to_stock_transfer.rb +1 -1
- data/db/migrate/20130611054351_rename_shipping_methods_zones_to_spree_shipping_methods_zones.rb +0 -5
- data/db/migrate/20130611185927_add_user_id_index_to_spree_orders.rb +5 -0
- data/db/migrate/20130618041418_add_updated_at_to_spree_countries.rb +9 -0
- data/db/migrate/20130619012236_add_updated_at_to_spree_states.rb +9 -0
- data/db/migrate/20130802022321_migrate_tax_categories_to_line_items.rb +4 -5
- data/db/migrate/20130806145853_set_default_stock_location_on_shipments.rb +1 -1
- data/lib/generators/spree/dummy/dummy_generator.rb +3 -14
- data/lib/generators/spree/dummy/templates/rails/database.yml +0 -10
- data/lib/generators/spree/dummy/templates/rails/test.rb +2 -7
- data/lib/generators/spree/install/install_generator.rb +11 -8
- data/lib/spree/core/calculated_adjustments.rb +9 -8
- data/lib/spree/core/controller_helpers/auth.rb +2 -3
- data/lib/spree/core/controller_helpers/order.rb +8 -13
- data/lib/spree/core/controller_helpers/ssl.rb +13 -22
- data/lib/spree/core/controller_helpers/strong_parameters.rb +36 -0
- data/lib/spree/core/delegate_belongs_to.rb +0 -2
- data/lib/spree/core/engine.rb +1 -5
- data/lib/spree/core/ext/active_record.rb +2 -9
- data/lib/spree/core/permalinks.rb +1 -5
- data/lib/spree/core/product_duplicator.rb +2 -16
- data/lib/spree/core/product_filters.rb +37 -33
- data/lib/spree/core/search/base.rb +1 -1
- data/lib/spree/core/version.rb +1 -1
- data/lib/spree/core.rb +3 -31
- data/lib/spree/i18n.rb +0 -1
- data/lib/spree/money.rb +2 -177
- data/lib/spree/permitted_attributes.rb +95 -0
- data/lib/spree/promo/coupon_applicator.rb +4 -12
- data/lib/spree/testing_support/capybara_ext.rb +13 -17
- data/lib/spree/testing_support/common_rake.rb +1 -1
- data/lib/spree/testing_support/controller_requests.rb +3 -3
- data/lib/spree/testing_support/factories/credit_card_factory.rb +1 -1
- data/lib/spree/testing_support/factories/product_factory.rb +0 -4
- data/lib/spree/testing_support/factories/shipping_method_factory.rb +1 -3
- data/lib/spree/testing_support/factories/user_factory.rb +1 -1
- data/lib/spree/testing_support/factories/variant_factory.rb +0 -15
- data/lib/spree/testing_support/factories.rb +1 -1
- data/lib/spree/testing_support/order_walkthrough.rb +1 -1
- data/lib/tasks/core.rake +2 -2
- data/vendor/assets/javascripts/jquery.payment.js +497 -0
- metadata +166 -172
- data/app/views/spree/admin/shared/_report_order_criteria.html.erb +0 -17
- data/db/migrate/20130417120034_add_index_to_source_columns_on_adjustments.rb +0 -5
- data/db/migrate/20130830001033_add_shipping_category_to_shipping_methods_and_products.rb +0 -15
- data/db/migrate/20130830001159_migrate_old_shipping_calculators.rb +0 -19
- data/db/migrate/20130909115621_change_states_required_for_countries.rb +0 -9
- data/db/migrate/20131001013410_remove_unused_credit_card_fields.rb +0 -12
- data/db/migrate/20131026154747_add_track_inventory_to_variant.rb +0 -5
- data/db/migrate/20131113035136_add_channel_to_spree_orders.rb +0 -5
- data/db/migrate/20140120160805_add_index_to_variant_id_and_currency_on_prices.rb +0 -5
- data/db/migrate/20140205181631_default_variant_weight_to_zero.rb +0 -11
- data/db/migrate/20140415041315_add_user_id_created_by_id_index_to_order.rb +0 -5
- data/lib/spree/core/preference_rescue.rb +0 -25
@@ -13,19 +13,11 @@ module CapybaraExt
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def within_row(num, &block)
|
16
|
-
|
17
|
-
within("table.index tbody tr:nth-child(#{num})", &block)
|
18
|
-
else
|
19
|
-
within(:xpath, all("table.index tbody tr")[num-1].path, &block)
|
20
|
-
end
|
16
|
+
within("table.index tbody tr:nth-child(#{num})", &block)
|
21
17
|
end
|
22
18
|
|
23
19
|
def column_text(num)
|
24
|
-
|
25
|
-
find("td:nth-child(#{num})").text
|
26
|
-
else
|
27
|
-
all("td")[num-1].text
|
28
|
-
end
|
20
|
+
find("td:nth-child(#{num})").text
|
29
21
|
end
|
30
22
|
|
31
23
|
def set_select2_field(field, value)
|
@@ -36,8 +28,8 @@ module CapybaraExt
|
|
36
28
|
label = find_label_by_text(options[:from])
|
37
29
|
within label.first(:xpath,".//..") do
|
38
30
|
options[:from] = "##{find(".select2-container")["id"]}"
|
31
|
+
targetted_select2_search(value, options)
|
39
32
|
end
|
40
|
-
targetted_select2_search(value, options)
|
41
33
|
end
|
42
34
|
|
43
35
|
def targetted_select2_search(value, options)
|
@@ -51,8 +43,8 @@ module CapybaraExt
|
|
51
43
|
|
52
44
|
within label.first(:xpath,".//..") do
|
53
45
|
options[:from] = "##{find(".select2-container")["id"]}"
|
46
|
+
targetted_select2(value, options)
|
54
47
|
end
|
55
|
-
targetted_select2(value, options)
|
56
48
|
end
|
57
49
|
|
58
50
|
def select2_no_label value, options={}
|
@@ -73,10 +65,9 @@ module CapybaraExt
|
|
73
65
|
end
|
74
66
|
|
75
67
|
def select_select2_result(value)
|
76
|
-
#
|
77
|
-
|
78
|
-
|
79
|
-
end
|
68
|
+
#p %Q{$("div.select2-result-label:contains('#{value}')").mouseup()}
|
69
|
+
sleep(1)
|
70
|
+
page.execute_script(%Q{$("div.select2-result-label:contains('#{value}')").mouseup()})
|
80
71
|
end
|
81
72
|
|
82
73
|
def find_label_by_text(text)
|
@@ -103,7 +94,7 @@ module CapybaraExt
|
|
103
94
|
|
104
95
|
def wait_for_ajax
|
105
96
|
counter = 0
|
106
|
-
while page.
|
97
|
+
while page.execute_script("return $.active").to_i > 0
|
107
98
|
counter += 1
|
108
99
|
sleep(0.1)
|
109
100
|
raise "AJAX request took longer than 5 seconds." if counter >= 50
|
@@ -111,6 +102,11 @@ module CapybaraExt
|
|
111
102
|
end
|
112
103
|
end
|
113
104
|
|
105
|
+
Capybara.configure do |config|
|
106
|
+
config.match = :prefer_exact
|
107
|
+
config.ignore_hidden_elements = true
|
108
|
+
end
|
109
|
+
|
114
110
|
RSpec::Matchers.define :have_meta do |name, expected|
|
115
111
|
match do |actual|
|
116
112
|
has_css?("meta[name='#{name}'][content='#{expected}']", visible: false)
|
@@ -10,7 +10,7 @@ namespace :common do
|
|
10
10
|
args.with_defaults(:user_class => "Spree::LegacyUser")
|
11
11
|
require "#{ENV['LIB_NAME']}"
|
12
12
|
|
13
|
-
Spree::DummyGenerator.start ["--lib_name=#{ENV['LIB_NAME']}", "--
|
13
|
+
Spree::DummyGenerator.start ["--lib_name=#{ENV['LIB_NAME']}", "--quiet"]
|
14
14
|
Spree::InstallGenerator.start ["--lib_name=#{ENV['LIB_NAME']}", "--auto-accept", "--migrate=false", "--seed=false", "--sample=false", "--quiet", "--user_class=#{args[:user_class]}"]
|
15
15
|
|
16
16
|
puts "Setting up dummy database..."
|
@@ -4,9 +4,9 @@
|
|
4
4
|
# Inside your spec_helper.rb, include this module inside the RSpec.configure
|
5
5
|
# block by doing this:
|
6
6
|
#
|
7
|
-
# require 'spree/testing_support/controller_requests'
|
7
|
+
# require 'spree/core/testing_support/controller_requests'
|
8
8
|
# RSpec.configure do |c|
|
9
|
-
# c.include Spree::TestingSupport::ControllerRequests, :type => :controller
|
9
|
+
# c.include Spree::Core::TestingSupport::ControllerRequests, :type => :controller
|
10
10
|
# end
|
11
11
|
#
|
12
12
|
# Then, in your controller tests, you can access spree routes like this:
|
@@ -56,7 +56,7 @@ module Spree
|
|
56
56
|
|
57
57
|
def process_spree_action(action, parameters = nil, session = nil, flash = nil, method = "GET")
|
58
58
|
parameters ||= {}
|
59
|
-
process(action, parameters.merge!(:use_route => :spree), session, flash
|
59
|
+
process(action, method, parameters.merge!(:use_route => :spree), session, flash)
|
60
60
|
end
|
61
61
|
end
|
62
62
|
end
|
@@ -12,10 +12,6 @@ FactoryGirl.define do
|
|
12
12
|
# ensure stock item will be created for this products master
|
13
13
|
before(:create) { create(:stock_location) if Spree::StockLocation.count == 0 }
|
14
14
|
|
15
|
-
after(:create) do |p|
|
16
|
-
p.variants_including_master.each { |v| v.save! }
|
17
|
-
end
|
18
|
-
|
19
15
|
factory :custom_product do
|
20
16
|
name 'Custom Product'
|
21
17
|
price 17.99
|
@@ -4,9 +4,7 @@ FactoryGirl.define do
|
|
4
4
|
name 'UPS Ground'
|
5
5
|
|
6
6
|
before(:create) do |shipping_method, evaluator|
|
7
|
-
|
8
|
-
shipping_method.shipping_categories << (Spree::ShippingCategory.first || create(:shipping_category))
|
9
|
-
end
|
7
|
+
shipping_method.shipping_categories << (Spree::ShippingCategory.first || create(:shipping_category))
|
10
8
|
end
|
11
9
|
|
12
10
|
factory :shipping_method, class: Spree::ShippingMethod do
|
@@ -11,7 +11,7 @@ FactoryGirl.define do
|
|
11
11
|
authentication_token { generate(:user_authentication_token) } if Spree.user_class.attribute_method? :authentication_token
|
12
12
|
|
13
13
|
factory :admin_user do
|
14
|
-
spree_roles { [Spree::Role.
|
14
|
+
spree_roles { [Spree::Role.find_by(name: 'admin') || create(:role, name: 'admin')] }
|
15
15
|
end
|
16
16
|
end
|
17
17
|
end
|
@@ -9,8 +9,6 @@ FactoryGirl.define do
|
|
9
9
|
height { generate(:random_float) }
|
10
10
|
width { generate(:random_float) }
|
11
11
|
depth { generate(:random_float) }
|
12
|
-
is_master 0
|
13
|
-
track_inventory true
|
14
12
|
|
15
13
|
product { |p| p.association(:base_product) }
|
16
14
|
option_values { [create(:option_value)] }
|
@@ -22,18 +20,5 @@ FactoryGirl.define do
|
|
22
20
|
# on_hand 5
|
23
21
|
product { |p| p.association(:product) }
|
24
22
|
end
|
25
|
-
|
26
|
-
factory :master_variant do
|
27
|
-
is_master 1
|
28
|
-
end
|
29
|
-
|
30
|
-
factory :on_demand_variant do
|
31
|
-
track_inventory false
|
32
|
-
|
33
|
-
factory :on_demand_master_variant do
|
34
|
-
is_master 1
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
23
|
end
|
39
24
|
end
|
@@ -50,7 +50,7 @@ class OrderWalkthrough
|
|
50
50
|
end
|
51
51
|
|
52
52
|
def self.payment(order)
|
53
|
-
order.payments.create!(
|
53
|
+
order.payments.create!(:payment_method => Spree::PaymentMethod.first, :amount => order.total)
|
54
54
|
# TODO: maybe look at some way of making this payment_state change automatic
|
55
55
|
order.payment_state = 'paid'
|
56
56
|
order.next!
|
data/lib/tasks/core.rake
CHANGED
@@ -86,8 +86,8 @@ use rake db:load_file[/absolute/path/to/sample/filename.rb]}
|
|
86
86
|
end
|
87
87
|
|
88
88
|
if load_sample
|
89
|
-
#
|
90
|
-
|
89
|
+
#prevent errors for missing attributes (since rails 3.1 upgrade)
|
90
|
+
|
91
91
|
Rake::Task["spree_sample:load"].invoke
|
92
92
|
end
|
93
93
|
|