spree_core 1.0.0.rc1 → 1.0.0.rc2
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +1 -1
- data/app/assets/javascripts/admin/shipping_methods.js +14 -0
- data/app/assets/stylesheets/store/reset.css +1 -1
- data/app/controllers/spree/admin/orders/customer_details_controller.rb +1 -1
- data/app/controllers/spree/admin/resource_controller.rb +1 -1
- data/app/controllers/spree/admin/shipping_methods_controller.rb +9 -0
- data/app/controllers/spree/admin/users_controller.rb +7 -0
- data/app/helpers/spree/admin/base_helper.rb +4 -3
- data/app/helpers/spree/admin/navigation_helper.rb +3 -1
- data/app/models/spree/order.rb +3 -3
- data/app/models/spree/preferences/preferable.rb +9 -0
- data/app/models/spree/product.rb +2 -2
- data/app/models/spree/shipment.rb +1 -1
- data/app/models/spree/shipping_category.rb +2 -0
- data/app/models/spree/shipping_method.rb +17 -1
- data/app/models/spree/tax_rate.rb +3 -1
- data/app/models/spree/variant.rb +1 -1
- data/app/models/spree/zone.rb +9 -9
- data/app/views/spree/admin/adjustments/edit.html.erb +1 -1
- data/app/views/spree/admin/orders/_form.html.erb +1 -1
- data/app/views/spree/admin/orders/customer_details/_form.html.erb +1 -1
- data/app/views/spree/admin/payment_methods/edit.html.erb +1 -1
- data/app/views/spree/admin/product_properties/index.html.erb +1 -1
- data/app/views/spree/admin/products/edit.html.erb +1 -1
- data/app/views/spree/admin/shared/_destroy.js.erb +1 -1
- data/app/views/spree/admin/shipments/edit.html.erb +1 -1
- data/app/views/spree/admin/shipping_methods/_form.html.erb +15 -0
- data/app/views/spree/admin/taxons/edit.html.erb +1 -1
- data/app/views/spree/admin/zones/_form.html.erb +4 -5
- data/app/views/spree/checkout/edit.html.erb +1 -1
- data/app/views/spree/checkout/registration.html.erb +1 -1
- data/app/views/spree/orders/new.html.erb +1 -1
- data/app/views/spree/shared/_filters.html.erb +1 -1
- data/config/locales/en.yml +9 -2
- data/config/routes.rb +1 -0
- data/db/migrate/20120105193911_associate_shipping_methods_and_shipping_categories.rb +7 -0
- data/db/migrate/20120105195817_add_match_rules_to_shipping_methods.rb +7 -0
- data/lib/generators/spree/dummy/dummy_generator.rb +1 -0
- data/lib/generators/spree/dummy/templates/rails/script/rails +6 -0
- data/lib/generators/spree/install/install_generator.rb +167 -0
- data/lib/generators/spree/install/templates/app/assets/javascripts/admin/all.js +15 -0
- data/lib/generators/spree/install/templates/app/assets/javascripts/store/all.js +15 -0
- data/lib/generators/spree/install/templates/app/assets/stylesheets/admin/all.css +16 -0
- data/lib/generators/spree/install/templates/app/assets/stylesheets/store/all.css +16 -0
- data/lib/generators/spree/install/templates/config/initializers/spree.rb +9 -0
- data/lib/spree/core.rb +2 -2
- data/lib/spree/core/controller_helpers.rb +6 -0
- data/lib/spree/core/engine.rb +1 -1
- data/lib/spree/core/middleware/seo_assist.rb +2 -1
- data/lib/spree/core/ssl_requirement.rb +2 -2
- data/lib/spree/core/testing_support/common_rake.rb +1 -1
- data/lib/spree/core/testing_support/factories/shipping_method_factory.rb +10 -0
- data/lib/spree/core/version.rb +1 -1
- data/lib/spree/product_filters.rb +9 -7
- metadata +125 -242
- data/lib/generators/spree/extension/extension_generator.rb +0 -25
- data/lib/generators/spree/extension/templates/Gemfile +0 -13
- data/lib/generators/spree/extension/templates/LICENSE +0 -26
- data/lib/generators/spree/extension/templates/README.md +0 -21
- data/lib/generators/spree/extension/templates/Rakefile +0 -29
- data/lib/generators/spree/extension/templates/Versionfile +0 -9
- data/lib/generators/spree/extension/templates/app/assets/javascripts/admin/%file_name%.js +0 -1
- data/lib/generators/spree/extension/templates/app/assets/javascripts/store/%file_name%.js +0 -1
- data/lib/generators/spree/extension/templates/app/assets/stylesheets/admin/%file_name%.css +0 -3
- data/lib/generators/spree/extension/templates/app/assets/stylesheets/store/%file_name%.css +0 -3
- data/lib/generators/spree/extension/templates/config/locales/en.yml +0 -5
- data/lib/generators/spree/extension/templates/config/routes.rb +0 -3
- data/lib/generators/spree/extension/templates/extension.gemspec +0 -26
- data/lib/generators/spree/extension/templates/gitignore +0 -10
- data/lib/generators/spree/extension/templates/lib/%file_name%.rb.tt +0 -2
- data/lib/generators/spree/extension/templates/lib/%file_name%/engine.rb.tt +0 -20
- data/lib/generators/spree/extension/templates/lib/generators/%file_name%/install/install_generator.rb.tt +0 -29
- data/lib/generators/spree/extension/templates/rspec +0 -1
- data/lib/generators/spree/extension/templates/script/rails.tt +0 -5
- data/lib/generators/spree/extension/templates/spec/spec_helper.rb.tt +0 -32
@@ -1,7 +1,7 @@
|
|
1
1
|
<%= form_tag '', :method => :get, :id => 'sidebar_products_search' do %>
|
2
2
|
<% params[:search] ||= {} %>
|
3
3
|
<%= hidden_field_tag 'per_page', params[:per_page] %>
|
4
|
-
<% filters = @taxon ? @taxon.applicable_filters : [ProductFilters.all_taxons] %>
|
4
|
+
<% filters = @taxon ? @taxon.applicable_filters : [Spree::ProductFilters.all_taxons] %>
|
5
5
|
<% filters.each do |filter| %>
|
6
6
|
<% labels = filter[:labels] || filter[:conds].map {|m,c| [m,m]} %>
|
7
7
|
<% next if labels.empty? %>
|
data/config/locales/en.yml
CHANGED
@@ -263,6 +263,7 @@ en:
|
|
263
263
|
assign_taxons: "Assign Taxons"
|
264
264
|
authorization_failure: "Authorization Failure"
|
265
265
|
authorized: Authorized
|
266
|
+
availability: "Availability"
|
266
267
|
available_on: "Available On"
|
267
268
|
available_taxons: "Available Taxons"
|
268
269
|
awaiting_return: Awaiting Return
|
@@ -493,12 +494,11 @@ en:
|
|
493
494
|
live: "Live"
|
494
495
|
loading: Loading
|
495
496
|
locale_changed: "Locale Changed"
|
496
|
-
log_in: "Log In"
|
497
497
|
logged_in_as: "Logged in as"
|
498
498
|
logged_in_succesfully: "Logged in successfully"
|
499
499
|
logged_out: "You have been logged out."
|
500
500
|
login: Login
|
501
|
-
login_as_existing: "
|
501
|
+
login_as_existing: "Login as Existing Customer"
|
502
502
|
login_failed: "Login authentication failed."
|
503
503
|
login_name: Login
|
504
504
|
logout: Logout
|
@@ -511,6 +511,11 @@ en:
|
|
511
511
|
make_refund: Make refund
|
512
512
|
mark_shipped: "Mark Shipped"
|
513
513
|
master_price: "Master Price"
|
514
|
+
match_choices:
|
515
|
+
none: "None"
|
516
|
+
one: "One"
|
517
|
+
all: "All"
|
518
|
+
match_rule: "Products That Must Match:"
|
514
519
|
max_items: Max Items
|
515
520
|
meta_description: "Meta Description"
|
516
521
|
meta_keywords: "Meta Keywords"
|
@@ -662,6 +667,7 @@ en:
|
|
662
667
|
previous: Previous
|
663
668
|
price: Price
|
664
669
|
price_bucket: Price Bucket
|
670
|
+
price_range: Price Range
|
665
671
|
problem_authorizing_card: "Problem authorizing credit card"
|
666
672
|
problem_capturing_card: "Problem capturing credit card"
|
667
673
|
problems_processing_order: "We had problems processing your order"
|
@@ -884,6 +890,7 @@ en:
|
|
884
890
|
shipping_categories: "Shipping Categories"
|
885
891
|
shipping_categories_description: "Manage shipping categories to identify which products can be shipped via which method."
|
886
892
|
shipping_category: Shipping Category
|
893
|
+
shipping_category_choose: "Shipping Category"
|
887
894
|
shipping_cost: Cost
|
888
895
|
shipping_error: "Shipping Error"
|
889
896
|
shipping_instructions: "Shipping Instructions"
|
data/config/routes.rb
CHANGED
@@ -41,6 +41,7 @@ module Spree
|
|
41
41
|
template "rails/boot.rb", "#{dummy_path}/config/boot.rb", :force => true
|
42
42
|
template "rails/application.rb", "#{dummy_path}/config/application.rb", :force => true
|
43
43
|
template "rails/routes.rb", "#{dummy_path}/config/routes.rb", :force => true
|
44
|
+
template "rails/script/rails", "#{dummy_path}/spec/dummy/script/rails", :force => true
|
44
45
|
end
|
45
46
|
|
46
47
|
def test_dummy_clean
|
@@ -0,0 +1,6 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
|
3
|
+
|
4
|
+
APP_PATH = File.expand_path('../../config/application', __FILE__)
|
5
|
+
require File.expand_path('../../config/boot', __FILE__)
|
6
|
+
require 'rails/commands'
|
@@ -0,0 +1,167 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
require 'highline/import'
|
3
|
+
require 'bundler'
|
4
|
+
require 'bundler/cli'
|
5
|
+
|
6
|
+
module Spree
|
7
|
+
class InstallGenerator < Rails::Generators::Base
|
8
|
+
class_option :migrate, :type => :boolean, :default => true, :banner => 'Run Spree migrations'
|
9
|
+
class_option :seed, :type => :boolean, :default => true, :banner => 'load seed data (migrations must be run)'
|
10
|
+
class_option :sample, :type => :boolean, :default => true, :banner => 'load sample data (migrations must be run)'
|
11
|
+
class_option :auto_accept, :type => :boolean
|
12
|
+
class_option :lib_name, :type => :string, :default => 'spree'
|
13
|
+
|
14
|
+
def self.source_paths
|
15
|
+
paths = self.superclass.source_paths
|
16
|
+
paths << File.expand_path('../templates', "../../#{__FILE__}")
|
17
|
+
paths << File.expand_path('../templates', "../#{__FILE__}")
|
18
|
+
paths << File.expand_path('../templates', __FILE__)
|
19
|
+
paths.flatten
|
20
|
+
end
|
21
|
+
|
22
|
+
def prepare_options
|
23
|
+
@run_migrations = options[:migrate]
|
24
|
+
@load_seed_data = options[:seed]
|
25
|
+
@load_sample_data = options[:sample]
|
26
|
+
|
27
|
+
unless @run_migrations
|
28
|
+
@load_seed_data = false
|
29
|
+
@load_sample_data = false
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def add_files
|
34
|
+
template 'config/initializers/spree.rb', 'config/initializers/spree.rb'
|
35
|
+
end
|
36
|
+
|
37
|
+
def config_spree_yml
|
38
|
+
create_file "config/spree.yml" do
|
39
|
+
settings = { 'version' => Spree.version }
|
40
|
+
|
41
|
+
settings.to_yaml
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def remove_unneeded_files
|
46
|
+
remove_file "public/index.html"
|
47
|
+
end
|
48
|
+
|
49
|
+
def additional_tweaks
|
50
|
+
return unless File.exists? 'public/robots.txt'
|
51
|
+
append_file "public/robots.txt", <<-ROBOTS
|
52
|
+
User-agent: *
|
53
|
+
Disallow: /checkouts
|
54
|
+
Disallow: /orders
|
55
|
+
Disallow: /countries
|
56
|
+
Disallow: /line_items
|
57
|
+
Disallow: /password_resets
|
58
|
+
Disallow: /states
|
59
|
+
Disallow: /user_sessions
|
60
|
+
Disallow: /users
|
61
|
+
ROBOTS
|
62
|
+
end
|
63
|
+
|
64
|
+
def setup_assets
|
65
|
+
@lib_name = 'spree'
|
66
|
+
%w{javascripts stylesheets images}.each do |path|
|
67
|
+
empty_directory "app/assets/#{path}/store"
|
68
|
+
empty_directory "app/assets/#{path}/admin"
|
69
|
+
end
|
70
|
+
|
71
|
+
template "app/assets/javascripts/store/all.js"
|
72
|
+
template "app/assets/javascripts/admin/all.js"
|
73
|
+
template "app/assets/stylesheets/store/all.css"
|
74
|
+
template "app/assets/stylesheets/admin/all.css"
|
75
|
+
end
|
76
|
+
|
77
|
+
def create_overrides_directory
|
78
|
+
empty_directory "app/overrides"
|
79
|
+
end
|
80
|
+
|
81
|
+
def configure_application
|
82
|
+
application <<-APP
|
83
|
+
|
84
|
+
config.to_prepare do
|
85
|
+
# Load application's model / class decorators
|
86
|
+
Dir.glob(File.join(File.dirname(__FILE__), "../app/**/*_decorator*.rb")) do |c|
|
87
|
+
Rails.configuration.cache_classes ? require(c) : load(c)
|
88
|
+
end
|
89
|
+
|
90
|
+
# Load application's view overrides
|
91
|
+
Dir.glob(File.join(File.dirname(__FILE__), "../app/overrides/*.rb")) do |c|
|
92
|
+
Rails.configuration.cache_classes ? require(c) : load(c)
|
93
|
+
end
|
94
|
+
end
|
95
|
+
APP
|
96
|
+
|
97
|
+
append_file "config/environment.rb", "\nActiveRecord::Base.include_root_in_json = true\n"
|
98
|
+
end
|
99
|
+
|
100
|
+
def include_seed_data
|
101
|
+
append_file "db/seeds.rb", <<-SEEDS
|
102
|
+
\n
|
103
|
+
Spree::Core::Engine.load_seed if defined?(Spree::Core)
|
104
|
+
Spree::Auth::Engine.load_seed if defined?(Spree::Auth)
|
105
|
+
SEEDS
|
106
|
+
end
|
107
|
+
|
108
|
+
def install_migrations
|
109
|
+
say_status :copying, "migrations"
|
110
|
+
silence_stream(STDOUT) do
|
111
|
+
silence_warnings { rake 'railties:install:migrations' }
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
def run_migrations
|
116
|
+
if @run_migrations
|
117
|
+
say_status :running, "migrations"
|
118
|
+
rake('db:migrate')
|
119
|
+
else
|
120
|
+
say_status :skipping, "migrations (don't forget to run rake db:migrate)"
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
def populate_seed_data
|
125
|
+
if @load_seed_data
|
126
|
+
say_status :loading, "seed data"
|
127
|
+
rake_options=[]
|
128
|
+
rake_options << "AUTO_ACCEPT=1" if options[:auto_accept]
|
129
|
+
rake("db:seed #{rake_options.join(' ')}")
|
130
|
+
else
|
131
|
+
say_status :skipping, "seed data (you can always run rake db:seed)"
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
def load_sample_data
|
136
|
+
if @load_sample_data
|
137
|
+
say_status :loading, "sample data"
|
138
|
+
rake('spree_sample:load')
|
139
|
+
else
|
140
|
+
say_status :skipping, "sample data (you can always run rake spree_sample:load)"
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
def notify_about_routes
|
145
|
+
insert_into_file File.join('config', 'routes.rb'), :after => "Application.routes.draw do\n" do
|
146
|
+
" # Mount Spree's routes\n mount Spree::Core::Engine, :at => '/'\n"
|
147
|
+
end
|
148
|
+
|
149
|
+
unless options[:quiet]
|
150
|
+
puts "*" * 50
|
151
|
+
puts "We added the following line to your application's config/routes.rb file:"
|
152
|
+
puts " "
|
153
|
+
puts " mount Spree::Core::Engine, :at => '/'"
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
157
|
+
def complete
|
158
|
+
unless options[:quiet]
|
159
|
+
puts "*" * 50
|
160
|
+
puts "Spree has been installed successfully. You're all ready to go!"
|
161
|
+
puts " "
|
162
|
+
puts "Enjoy!"
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
166
|
+
end
|
167
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into including all the files listed below.
|
2
|
+
// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
|
3
|
+
// be included in the compiled file accessible from http://example.com/assets/application.js
|
4
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
5
|
+
// the compiled file.
|
6
|
+
//
|
7
|
+
<% if options[:lib_name] == 'spree' %>
|
8
|
+
//= require admin/spree_core
|
9
|
+
//= require admin/spree_auth
|
10
|
+
//= require admin/spree_api
|
11
|
+
//= require admin/spree_promo
|
12
|
+
<% else %>
|
13
|
+
//= require admin/<%= options[:lib_name].gsub("/", "_") %>
|
14
|
+
<% end %>
|
15
|
+
//= require_tree .
|
@@ -0,0 +1,15 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into including all the files listed below.
|
2
|
+
// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
|
3
|
+
// be included in the compiled file accessible from http://example.com/assets/application.js
|
4
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
5
|
+
// the compiled file.
|
6
|
+
//
|
7
|
+
<% if options[:lib_name] == 'spree' %>
|
8
|
+
//= require store/spree_core
|
9
|
+
//= require store/spree_auth
|
10
|
+
//= require store/spree_api
|
11
|
+
//= require store/spree_promo
|
12
|
+
<% else %>
|
13
|
+
//= require store/<%= options[:lib_name].gsub("/", "_") %>
|
14
|
+
<% end %>
|
15
|
+
//= require_tree .
|
@@ -0,0 +1,16 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll automatically include all the stylesheets available in this directory
|
3
|
+
* and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
|
4
|
+
* the top of the compiled file, but it's generally better to create a new file per style scope.
|
5
|
+
*
|
6
|
+
<% if options[:lib_name] == 'spree' %>
|
7
|
+
*= require admin/spree_core
|
8
|
+
*= require admin/spree_auth
|
9
|
+
*= require admin/spree_api
|
10
|
+
*= require admin/spree_promo
|
11
|
+
<% else %>
|
12
|
+
*= require admin/<%= options[:lib_name].gsub("/", "_") %>
|
13
|
+
<% end %>
|
14
|
+
*= require_self
|
15
|
+
*= require_tree .
|
16
|
+
*/
|
@@ -0,0 +1,16 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll automatically include all the stylesheets available in this directory
|
3
|
+
* and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
|
4
|
+
* the top of the compiled file, but it's generally better to create a new file per style scope.
|
5
|
+
*
|
6
|
+
<% if options[:lib_name] == 'spree' %>
|
7
|
+
*= require store/spree_core
|
8
|
+
*= require store/spree_auth
|
9
|
+
*= require store/spree_api
|
10
|
+
*= require store/spree_promo
|
11
|
+
<% else %>
|
12
|
+
*= require store/<%= options[:lib_name].gsub("/", "_") %>
|
13
|
+
<% end %>
|
14
|
+
*= require_self
|
15
|
+
*= require_tree .
|
16
|
+
*/
|
data/lib/spree/core.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#++
|
2
|
-
# Copyright (c) 2007-
|
2
|
+
# Copyright (c) 2007-2012, Spree Commerce, Inc. and other contributors
|
3
3
|
# All rights reserved.
|
4
4
|
#
|
5
5
|
# Redistribution and use in source and binary forms, with or without modification,
|
@@ -10,7 +10,7 @@
|
|
10
10
|
# * Redistributions in binary form must reproduce the above copyright notice,
|
11
11
|
# this list of conditions and the following disclaimer in the documentation
|
12
12
|
# and/or other materials provided with the distribution.
|
13
|
-
# * Neither the name of the
|
13
|
+
# * Neither the name of the Spree Commerce, Inc. nor the names of its
|
14
14
|
# contributors may be used to endorse or promote products derived from this
|
15
15
|
# software without specific prior written permission.
|
16
16
|
#
|
@@ -111,6 +111,12 @@ module Spree
|
|
111
111
|
ActiveSupport::Deprecation.warn "current_gateway is deprecated and will be removed in Spree > 1.0"
|
112
112
|
@current_gateway ||= Gateway.current
|
113
113
|
end
|
114
|
+
|
115
|
+
def associate_user
|
116
|
+
return unless current_user and current_order
|
117
|
+
current_order.associate_user!(current_user)
|
118
|
+
session[:guest_token] = nil
|
119
|
+
end
|
114
120
|
|
115
121
|
#RAILS 3 TODO
|
116
122
|
# # Load all models using STI to fix associations such as @order.credits giving no results and resulting in incorrect order totals
|
data/lib/spree/core/engine.rb
CHANGED
@@ -69,7 +69,7 @@ module Spree
|
|
69
69
|
end
|
70
70
|
|
71
71
|
# sets the manifests / assets to be precompiled
|
72
|
-
initializer "spree.assets.precompile"
|
72
|
+
initializer "spree.assets.precompile" do |app|
|
73
73
|
app.config.assets.precompile += ['store/all.*', 'admin/all.*', 'admin/orders/edit_form.js', 'jqPlot/excanvas.min.js', 'admin/images/new.js', 'jquery.jstree/themes/apple/*']
|
74
74
|
end
|
75
75
|
|
@@ -10,13 +10,14 @@ module Spree
|
|
10
10
|
def call(env)
|
11
11
|
request = Rack::Request.new(env)
|
12
12
|
params = request.params
|
13
|
+
|
13
14
|
taxon_id = params['taxon']
|
14
15
|
|
15
16
|
#redirect requests using taxon id's to their permalinks
|
16
17
|
if !taxon_id.blank? && !taxon_id.is_a?(Hash) && taxon = Taxon.find(taxon_id)
|
17
18
|
params.delete('taxon')
|
18
19
|
|
19
|
-
return build_response(params, "/t/#{taxon.permalink}" )
|
20
|
+
return build_response(params, "#{request.script_name}/t/#{taxon.permalink}" )
|
20
21
|
elsif env["PATH_INFO"] =~ /^\/(t|products)(\/\S+)?\/$/
|
21
22
|
#ensures no trailing / for taxon and product urls
|
22
23
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# ++
|
2
|
-
# Copyright (c) 2007-
|
2
|
+
# Copyright (c) 2007-2012, Spree Commerce, Inc. and other contributors
|
3
3
|
# All rights reserved.
|
4
4
|
#
|
5
5
|
# Redistribution and use in source and binary forms, with or without modification,
|
@@ -10,7 +10,7 @@
|
|
10
10
|
# * Redistributions in binary form must reproduce the above copyright notice,
|
11
11
|
# this list of conditions and the following disclaimer in the documentation
|
12
12
|
# and/or other materials provided with the distribution.
|
13
|
-
# * Neither the name of the
|
13
|
+
# * Neither the name of the Spree Commerce, Inc. nor the names of its
|
14
14
|
# contributors may be used to endorse or promote products derived from this
|
15
15
|
# software without specific prior written permission.
|
16
16
|
#
|
@@ -8,7 +8,7 @@ namespace :common do
|
|
8
8
|
require "#{ENV['LIB_NAME']}"
|
9
9
|
|
10
10
|
Spree::DummyGenerator.start ["--lib_name=#{ENV['LIB_NAME']}", "--database=#{ENV['DB_NAME']}", "--quiet"]
|
11
|
-
Spree::InstallGenerator.start ["--lib_name=#{ENV['LIB_NAME']}", "--
|
11
|
+
Spree::InstallGenerator.start ["--lib_name=#{ENV['LIB_NAME']}", "--auto-accept", "--migrate=false", "--seed=false", "--sample=false"]
|
12
12
|
|
13
13
|
puts "Setting up dummy database..."
|
14
14
|
cmd = "bundle exec rake db:drop db:create db:migrate RAILS_ENV=test AUTO_ACCEPT=true"
|
@@ -10,4 +10,14 @@ FactoryGirl.define do
|
|
10
10
|
name 'UPS Ground'
|
11
11
|
calculator { |sm| Factory(:no_amount_calculator, :calculable_id => sm.object_id, :calculable_type => 'Spree::ShippingMethod') }
|
12
12
|
end
|
13
|
+
|
14
|
+
factory :shipping_method_with_category, :class => Spree::ShippingMethod do
|
15
|
+
zone { |a| Spree::Zone.find_by_name('GlobalZone') || a.association(:global_zone) }
|
16
|
+
name 'UPS Ground'
|
17
|
+
calculator { |sm| Factory(:calculator, :calculable_id => sm.object_id, :calculable_type => 'Spree::ShippingMethod') }
|
18
|
+
match_none nil
|
19
|
+
match_one nil
|
20
|
+
match_all nil
|
21
|
+
association(:shipping_category, :factory => :shipping_category)
|
22
|
+
end
|
13
23
|
end
|