spree 0.6.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of spree might be problematic. Click here for more details.
- data/CHANGELOG +30 -0
- data/CONTRIBUTORS +38 -20
- data/app/controllers/admin/creditcard_payments_controller.rb +10 -3
- data/app/controllers/admin/orders_controller.rb +17 -16
- data/app/controllers/admin/products_controller.rb +12 -14
- data/app/controllers/admin/reports_controller.rb +12 -14
- data/app/controllers/admin/users_controller.rb +10 -5
- data/app/controllers/admin/zones_controller.rb +4 -1
- data/app/controllers/application.rb +0 -1
- data/app/controllers/checkout_controller.rb +96 -0
- data/app/controllers/content_controller.rb +11 -1
- data/app/controllers/orders_controller.rb +12 -33
- data/app/controllers/products_controller.rb +12 -7
- data/app/controllers/spree/base_controller.rb +1 -1
- data/app/controllers/states_controller.rb +14 -2
- data/app/controllers/taxons_controller.rb +6 -2
- data/app/controllers/users_controller.rb +9 -6
- data/app/helpers/application_helper.rb +1 -11
- data/app/helpers/products_helper.rb +3 -1
- data/app/helpers/spree/base_helper.rb +0 -26
- data/app/models/address.rb +3 -3
- data/app/models/app_configuration.rb +1 -0
- data/app/models/country.rb +4 -0
- data/app/models/creditcard.rb +6 -1
- data/app/models/creditcard_payment.rb +1 -1
- data/app/models/inventory_unit.rb +4 -1
- data/app/models/order.rb +37 -21
- data/app/models/product.rb +19 -8
- data/{vendor/extensions/shipping/app → app}/models/shipment.rb +20 -4
- data/{vendor/extensions/shipping/app → app}/models/shipping_category.rb +0 -0
- data/{vendor/extensions/shipping/app → app}/models/shipping_method.rb +6 -4
- data/app/models/state.rb +5 -0
- data/app/models/user.rb +4 -2
- data/app/models/variant.rb +19 -1
- data/app/presenters/checkout_presenter.rb +58 -0
- data/app/views/admin/creditcard_payments/edit.html.erb +1 -1
- data/app/views/admin/option_types/available.html.erb +1 -1
- data/app/views/admin/orders/index.html.erb +28 -18
- data/app/views/admin/orders/show.html.erb +1 -1
- data/app/views/admin/payments/index.html.erb +1 -1
- data/app/views/admin/products/_images.html.erb +1 -1
- data/app/views/admin/products/index.html.erb +17 -13
- data/app/views/admin/users/index.html.erb +8 -8
- data/app/views/admin/zones/index.html.erb +5 -2
- data/app/views/checkout/_form.html.erb +165 -0
- data/app/views/{creditcards → checkout}/cvv.html.erb +1 -1
- data/app/views/checkout/new.html.erb +6 -0
- data/app/views/layouts/admin.html.erb +2 -3
- data/app/views/layouts/application.html.erb +1 -1
- data/app/views/orders/_form.html.erb +6 -4
- data/app/views/orders/_google_order.html.erb +24 -0
- data/app/views/orders/_line_item.html.erb +2 -1
- data/app/views/orders/show.html.erb +4 -1
- data/app/views/products/index.html.erb +2 -1
- data/app/views/products/show.html.erb +4 -4
- data/app/views/shared/_footer.html.erb +12 -1
- data/app/views/shared/_login.html.erb +1 -1
- data/app/views/shared/_order_details.html.erb +8 -9
- data/app/views/shared/_products.html.erb +1 -1
- data/app/views/shared/_report_criteria.html.erb +28 -28
- data/app/views/states/index.js.erb +10 -1
- data/config/environment.rb +10 -4
- data/config/initializers/searchlogic.rb +6 -0
- data/config/locales/de.yml +14 -0
- data/config/locales/en-GB.yml +20 -6
- data/config/locales/en-US.yml +20 -4
- data/config/locales/es.yml +14 -0
- data/config/locales/fr-FR.yml +463 -0
- data/config/locales/fr-FR_rails.yml +115 -0
- data/config/locales/it.yml +14 -0
- data/config/locales/nb-NO.yml +457 -0
- data/config/locales/nb-NO_rails.yml +105 -0
- data/config/locales/pl.yml +14 -0
- data/config/locales/pt-BR.yml +14 -0
- data/config/locales/pt-PT.yml +14 -0
- data/config/locales/ru-RU.yml +458 -0
- data/config/locales/ru-RU_rails.yml +154 -0
- data/config/routes.rb +11 -4
- data/db/migrate/20090204200045_add_order_permalink.rb +13 -0
- data/db/migrate/20090225231119_add_more_needed_keys_items_and_conf.rb +19 -0
- data/db/migrate/20090302221152_give_all_users_user_role.rb +13 -0
- data/db/sample/orders.yml +1 -1
- data/lib/generators/instance/instance_generator.rb +1 -1
- data/lib/spree.rb +1 -1
- data/lib/spree/setup.rb +1 -1
- data/lib/tasks/database.rake +5 -2
- data/lib/tasks/release.rake +1 -1
- data/lib/tasks/upgrade.rake +11 -0
- data/public/assets/products/1009/mini/sean.jpg +0 -0
- data/public/assets/products/1009/original/sean.jpg +0 -0
- data/public/assets/products/1009/product/sean.jpg +0 -0
- data/public/assets/products/1009/small/sean.jpg +0 -0
- data/public/images/ajax_loader.gif +0 -0
- data/public/javascripts/checkout.js +284 -0
- data/public/javascripts/jquery-1.3.2.min.js +19 -0
- data/public/javascripts/jquery.validate.pack.js +15 -0
- data/public/stylesheets/checkout.css +25 -0
- data/public/stylesheets/spree-admin.css +6 -2
- data/public/stylesheets/spree.css +419 -432
- data/spec/controllers/countries_controller_spec.rb +3 -2
- data/spec/controllers/orders_controller_spec.rb +7 -5
- data/spec/controllers/states_controller_spec.rb +4 -2
- data/spec/models/creditcard_payment_spec.rb +6 -2
- data/spec/models/order_spec.rb +164 -157
- data/spec/models/product_spec.rb +2 -2
- data/vendor/extensions/payment_gateway/db/migrate/20090218091936_create_protx_gateway.rb +18 -0
- data/vendor/extensions/payment_gateway/lib/spree/payment_gateway.rb +7 -5
- data/vendor/extensions/shipping/app/controllers/admin/shipments_controller.rb +6 -5
- data/vendor/extensions/shipping/app/views/admin/shipments/index.html.erb +1 -1
- data/vendor/extensions/shipping/config/locales/nb-NO.yml +25 -0
- data/vendor/extensions/shipping/config/locales/ru-RU.yml +25 -0
- data/vendor/extensions/shipping/db/sample/shipping_methods.yml +5 -1
- data/vendor/extensions/shipping/db/sample/zone_members.yml +9 -1
- data/vendor/extensions/shipping/db/sample/zones.yml +4 -1
- data/vendor/extensions/shipping/lib/spree/shipping_calculator.rb +0 -16
- data/vendor/extensions/shipping/shipping_extension.rb +0 -15
- data/vendor/extensions/shipping/spec/models/shipping_method_spec.rb +16 -10
- data/vendor/extensions/shipping/spec/models/shipping_order_spec.rb +3 -17
- data/vendor/extensions/tax_calculator/config/locales/nb-NO.yml +30 -0
- data/vendor/extensions/tax_calculator/spec/models/{order_spec.rb → order_tax_calc_spec.rb} +2 -2
- data/vendor/gems/{active_presenter-0.0.4 → active_presenter-0.0.6}/.specification +3 -5
- data/vendor/gems/{active_presenter-0.0.4 → active_presenter-0.0.6}/LICENSE +0 -0
- data/vendor/gems/{active_presenter-0.0.4 → active_presenter-0.0.6}/README +9 -2
- data/vendor/gems/{active_presenter-0.0.4 → active_presenter-0.0.6}/Rakefile +0 -0
- data/vendor/gems/{active_presenter-0.0.4 → active_presenter-0.0.6}/lib/active_presenter.rb +0 -0
- data/vendor/gems/{active_presenter-0.0.4 → active_presenter-0.0.6}/lib/active_presenter/base.rb +38 -8
- data/vendor/gems/{active_presenter-0.0.4 → active_presenter-0.0.6}/lib/active_presenter/version.rb +1 -1
- data/vendor/gems/{active_presenter-0.0.4 → active_presenter-0.0.6}/lib/tasks/doc.rake +0 -0
- data/vendor/gems/{active_presenter-0.0.4 → active_presenter-0.0.6}/lib/tasks/gem.rake +0 -0
- data/vendor/gems/{active_presenter-0.0.4 → active_presenter-0.0.6}/test/base_test.rb +66 -30
- data/vendor/gems/{active_presenter-0.0.4 → active_presenter-0.0.6}/test/test_helper.rb +36 -0
- data/vendor/plugins/attribute_fu/lib/attribute_fu/associated_form_helper.rb +12 -4
- data/vendor/plugins/find_by_param/MIT-LICENSE +1 -1
- data/vendor/plugins/find_by_param/{README → README.markdown} +7 -1
- data/vendor/plugins/find_by_param/init.rb +0 -1
- data/vendor/plugins/find_by_param/lib/find_by_param.rb +23 -87
- data/vendor/plugins/find_by_param/test/find_by_param_test.rb +22 -8
- data/vendor/plugins/find_by_param/test/test_helper.rb +0 -1
- metadata +65 -193
- data/app/controllers/creditcards_controller.rb +0 -73
- data/app/models/order_filter.rb +0 -28
- data/app/models/user_filter.rb +0 -6
- data/app/views/creditcards/_form_credit_card.html.erb +0 -30
- data/app/views/creditcards/new.html.erb +0 -25
- data/app/views/shared/_paginate.html.erb +0 -34
- data/lib/plugins/paginating_find/CHANGELOG +0 -120
- data/lib/plugins/paginating_find/README +0 -89
- data/lib/plugins/paginating_find/init.rb +0 -2
- data/lib/plugins/paginating_find/lib/paginating_find.rb +0 -138
- data/lib/plugins/paginating_find/lib/paging_enumerator.rb +0 -158
- data/lib/plugins/paginating_find/lib/paging_helper.rb +0 -47
- data/lib/plugins/paginating_find/test_app/Rakefile +0 -10
- data/lib/plugins/paginating_find/test_app/app/controllers/application.rb +0 -2
- data/lib/plugins/paginating_find/test_app/config/boot.rb +0 -44
- data/lib/plugins/paginating_find/test_app/config/database.yml +0 -6
- data/lib/plugins/paginating_find/test_app/config/environment.rb +0 -53
- data/lib/plugins/paginating_find/test_app/config/environments/test.rb +0 -19
- data/lib/plugins/paginating_find/test_app/config/routes.rb +0 -22
- data/lib/plugins/paginating_find/test_app/script/breakpointer +0 -3
- data/lib/plugins/paginating_find/test_app/script/console +0 -3
- data/lib/plugins/paginating_find/test_app/test/fixtures/articles.yml +0 -19
- data/lib/plugins/paginating_find/test_app/test/fixtures/authors.yml +0 -7
- data/lib/plugins/paginating_find/test_app/test/fixtures/edits.yml +0 -11
- data/lib/plugins/paginating_find/test_app/test/fixtures/models.rb +0 -18
- data/lib/plugins/paginating_find/test_app/test/test_helper.rb +0 -33
- data/lib/plugins/paginating_find/test_app/test/unit/abstract_test.rb +0 -7
- data/lib/plugins/paginating_find/test_app/test/unit/group_test.rb +0 -40
- data/lib/plugins/paginating_find/test_app/test/unit/paginating_find_test.rb +0 -194
- data/lib/plugins/paginating_find/test_app/test/unit/paging_enumerator_test.rb +0 -143
- data/public/assets/products/1012/mini/bt.jpg +0 -0
- data/public/assets/products/1012/original/bt.jpg +0 -0
- data/public/assets/products/1012/product/bt.jpg +0 -0
- data/public/assets/products/1012/small/bt.jpg +0 -0
- data/spec/views/products/index.html.erb_spec.rb +0 -46
- data/spec/views/products/show.html.erb_spec.rb +0 -46
- data/vendor/extensions/shipping/app/controllers/shipments_controller.rb +0 -96
- data/vendor/extensions/shipping/app/helpers/shipments_helper.rb +0 -20
- data/vendor/extensions/shipping/app/views/orders/fatal_shipping.html.erb +0 -6
- data/vendor/extensions/shipping/app/views/shipments/_form.html.erb +0 -46
- data/vendor/extensions/shipping/app/views/shipments/edit.html.erb +0 -57
- data/vendor/extensions/shipping/app/views/shipments/new.html.erb +0 -10
@@ -1,158 +0,0 @@
|
|
1
|
-
# An enumerable that iterates through "pages" of objects.
|
2
|
-
# A page is loaded by the block callback provided to the initializer.
|
3
|
-
#
|
4
|
-
# pe = PagingEnumerable.new(25, 593) do |current_page|
|
5
|
-
# # return all results for the current_page!
|
6
|
-
# end
|
7
|
-
# pe.each { |result| puts result }
|
8
|
-
#
|
9
|
-
# Specify auto = true if you want the enumerator
|
10
|
-
# to iterate over all items rather than just those on the
|
11
|
-
# current page. If this option is enabled you may skip to the
|
12
|
-
# next page by invoking the next_page! method, or you may skip
|
13
|
-
# to any page using the move!(page) method.
|
14
|
-
#
|
15
|
-
# The callback may return an Enumerable containing the results
|
16
|
-
# for the current page, or an object if only one result is
|
17
|
-
# available for the current page.
|
18
|
-
#
|
19
|
-
# Author:: Alex Wolfe
|
20
|
-
# Copyright:: Copyright (c) 2006 Alex Wolfe
|
21
|
-
# License:: Distributes under the same terms as Ruby
|
22
|
-
# More Info:: http://cardboardrocket.com
|
23
|
-
#
|
24
|
-
class PagingEnumerator
|
25
|
-
include Enumerable
|
26
|
-
|
27
|
-
attr_accessor :results, :page, :first_page, :last_page, :stop_page, :page_size, :page_count, :size, :auto
|
28
|
-
|
29
|
-
def initialize(page_size, size, auto = false, page = 1, first_page=page, &callback)
|
30
|
-
self.page = page.to_i
|
31
|
-
self.page_size = page_size.to_i
|
32
|
-
self.size = size.to_i
|
33
|
-
self.auto = auto
|
34
|
-
self.first_page = first_page.to_i
|
35
|
-
self.last_page = page_count.to_i
|
36
|
-
self.stop_page = auto ? last_page : self.page
|
37
|
-
@callback = callback
|
38
|
-
end
|
39
|
-
|
40
|
-
def each
|
41
|
-
early_termination = false
|
42
|
-
while page <= stop_page && !early_termination
|
43
|
-
load_page
|
44
|
-
if results.respond_to?(:each)
|
45
|
-
results.each { |r| yield r }
|
46
|
-
else
|
47
|
-
yield results
|
48
|
-
end
|
49
|
-
self.page = self.page + 1
|
50
|
-
if (results.respond_to?(:size) && results.size < page_size)
|
51
|
-
early_termination = true
|
52
|
-
end
|
53
|
-
end
|
54
|
-
# force usage of next_page method
|
55
|
-
self.page = self.page - 1
|
56
|
-
self
|
57
|
-
end
|
58
|
-
|
59
|
-
def move!(page)
|
60
|
-
raise ArgumentError, "manually moving pages is only supported when auto paging is disabled" if auto
|
61
|
-
if page < self.first_page
|
62
|
-
self.page = first_page
|
63
|
-
elsif page > self.last_page
|
64
|
-
self.page = last_page
|
65
|
-
else
|
66
|
-
self.page = page
|
67
|
-
end
|
68
|
-
self.stop_page = page
|
69
|
-
end
|
70
|
-
|
71
|
-
def page_exists?(page)
|
72
|
-
page >= self.first_page && page <= self.last_page
|
73
|
-
end
|
74
|
-
|
75
|
-
def first_page!
|
76
|
-
move!(first_page)
|
77
|
-
end
|
78
|
-
|
79
|
-
def last_page!
|
80
|
-
move!(last_page)
|
81
|
-
end
|
82
|
-
|
83
|
-
# Move to the next page if auto paging is disabled.
|
84
|
-
def next_page!
|
85
|
-
move!(next_page) if next_page?
|
86
|
-
end
|
87
|
-
|
88
|
-
def next_page?
|
89
|
-
next_page ? true : false
|
90
|
-
end
|
91
|
-
|
92
|
-
def next_page
|
93
|
-
page >= page_count ? nil : page + 1
|
94
|
-
end
|
95
|
-
|
96
|
-
# Move to the previous page if auto paging is disabled.
|
97
|
-
def previous_page!
|
98
|
-
move!(previous_page) if previous_page?
|
99
|
-
end
|
100
|
-
|
101
|
-
def previous_page?
|
102
|
-
previous_page ? true : false
|
103
|
-
end
|
104
|
-
|
105
|
-
def previous_page
|
106
|
-
page == first_page ? nil : page - 1
|
107
|
-
end
|
108
|
-
|
109
|
-
def first_item
|
110
|
-
((self.page-1) * self.page_size) + 1
|
111
|
-
end
|
112
|
-
|
113
|
-
def last_item
|
114
|
-
[self.page * self.page_size, self.size].min
|
115
|
-
end
|
116
|
-
|
117
|
-
# How many pages are available?
|
118
|
-
def page_count
|
119
|
-
@page_count ||= (empty? or page_size == 0) ? 1 : (q, r = size.divmod(page_size); r == 0 ? q : q + 1)
|
120
|
-
end
|
121
|
-
|
122
|
-
def empty?
|
123
|
-
size == 0
|
124
|
-
end
|
125
|
-
|
126
|
-
# Get the results as an array. If the enumerator is not using :auto, this array
|
127
|
-
# will contain just the current page. Otherwise, this method will iterate all pages
|
128
|
-
# and return them as an array.
|
129
|
-
def to_a
|
130
|
-
array = []
|
131
|
-
each { |e| array << e }
|
132
|
-
array
|
133
|
-
end
|
134
|
-
|
135
|
-
def to_xml(options = {})
|
136
|
-
to_a.to_xml(options)
|
137
|
-
end
|
138
|
-
|
139
|
-
# Load the next page using the callback
|
140
|
-
def load_page
|
141
|
-
raise "Cannot load page because callback is not available. Has this enumerator been serialized?" unless @callback
|
142
|
-
self.results = @callback.call(page)
|
143
|
-
end
|
144
|
-
|
145
|
-
def _dump(depth)
|
146
|
-
load_page
|
147
|
-
Marshal.dump([results, page_size, size, false, page, first_page])
|
148
|
-
end
|
149
|
-
|
150
|
-
def PagingEnumerator._load(str)
|
151
|
-
params = Marshal.load(str)
|
152
|
-
results = params.shift
|
153
|
-
e = PagingEnumerator.new(*params)
|
154
|
-
e.results = results
|
155
|
-
e
|
156
|
-
end
|
157
|
-
|
158
|
-
end
|
@@ -1,47 +0,0 @@
|
|
1
|
-
module PaginatingFind
|
2
|
-
module Helpers
|
3
|
-
DEFAULT_OPTIONS = { :name => :page, :window_size => 2,
|
4
|
-
:always_show_anchors => true, :link_to_current_page => false,
|
5
|
-
:params => {} }
|
6
|
-
|
7
|
-
def paginating_links(paginator, options = {}, html_options = {})
|
8
|
-
name = options[:name] || DEFAULT_OPTIONS[:name]
|
9
|
-
params = (options[:params] || DEFAULT_OPTIONS[:params]).clone
|
10
|
-
|
11
|
-
paginating_links_each(paginator, options) do |n|
|
12
|
-
params[name] = n
|
13
|
-
link_to(n, params, html_options)
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
def paginating_links_each(paginator, options = {})
|
18
|
-
options = DEFAULT_OPTIONS.merge(options)
|
19
|
-
|
20
|
-
window = ((paginator.page - options[:window_size] + 1)..(paginator.page + options[:window_size] - 1)).select {|w| w >= paginator.first_page && w <= paginator.last_page }
|
21
|
-
|
22
|
-
html = ''
|
23
|
-
|
24
|
-
if options[:always_show_anchors] && !window.include?(paginator.first_page)
|
25
|
-
html << yield(paginator.first_page)
|
26
|
-
html << ' ... ' unless window.first - 1 == paginator.first_page
|
27
|
-
html << ' '
|
28
|
-
end
|
29
|
-
|
30
|
-
window.each do |p|
|
31
|
-
if paginator.page == p && !options[:link_to_current_page]
|
32
|
-
html << p.to_s
|
33
|
-
else
|
34
|
-
html << yield(p)
|
35
|
-
end
|
36
|
-
html << ' '
|
37
|
-
end
|
38
|
-
|
39
|
-
if options[:always_show_anchors] && !window.include?(paginator.last_page)
|
40
|
-
html << ' ... ' unless window.last + 1 == paginator.last_page
|
41
|
-
html << yield(paginator.last_page)
|
42
|
-
end
|
43
|
-
|
44
|
-
html
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
@@ -1,10 +0,0 @@
|
|
1
|
-
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
2
|
-
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
3
|
-
|
4
|
-
require(File.join(File.dirname(__FILE__), 'config', 'boot'))
|
5
|
-
|
6
|
-
require 'rake'
|
7
|
-
require 'rake/testtask'
|
8
|
-
require 'rake/rdoctask'
|
9
|
-
|
10
|
-
require 'tasks/rails'
|
@@ -1,44 +0,0 @@
|
|
1
|
-
# Don't change this file. Configuration is done in config/environment.rb and config/environments/*.rb
|
2
|
-
|
3
|
-
unless defined?(RAILS_ROOT)
|
4
|
-
root_path = File.join(File.dirname(__FILE__), '..')
|
5
|
-
|
6
|
-
unless RUBY_PLATFORM =~ /mswin32/
|
7
|
-
require 'pathname'
|
8
|
-
root_path = Pathname.new(root_path).cleanpath(true).to_s
|
9
|
-
end
|
10
|
-
|
11
|
-
RAILS_ROOT = root_path
|
12
|
-
end
|
13
|
-
|
14
|
-
unless defined?(Rails::Initializer)
|
15
|
-
if File.directory?("#{RAILS_ROOT}/vendor/rails")
|
16
|
-
require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer"
|
17
|
-
else
|
18
|
-
require 'rubygems'
|
19
|
-
|
20
|
-
environment_without_comments = IO.readlines(File.dirname(__FILE__) + '/environment.rb').reject { |l| l =~ /^#/ }.join
|
21
|
-
environment_without_comments =~ /[^#]RAILS_GEM_VERSION = '([\d.]+)'/
|
22
|
-
rails_gem_version = $1
|
23
|
-
|
24
|
-
if version = defined?(RAILS_GEM_VERSION) ? RAILS_GEM_VERSION : rails_gem_version
|
25
|
-
rails_gem = Gem.cache.search('rails', "=#{version}").first
|
26
|
-
|
27
|
-
if rails_gem
|
28
|
-
gem "rails", "=#{version}"
|
29
|
-
require rails_gem.full_gem_path + '/lib/initializer'
|
30
|
-
else
|
31
|
-
STDERR.puts %(Cannot find gem for Rails =#{version}:
|
32
|
-
Install the missing gem with 'gem install -v=#{version} rails', or
|
33
|
-
change environment.rb to define RAILS_GEM_VERSION with your desired version.
|
34
|
-
)
|
35
|
-
exit 1
|
36
|
-
end
|
37
|
-
else
|
38
|
-
gem "rails"
|
39
|
-
require 'initializer'
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
Rails::Initializer.run(:set_load_path)
|
44
|
-
end
|
@@ -1,53 +0,0 @@
|
|
1
|
-
# Be sure to restart your web server when you modify this file.
|
2
|
-
|
3
|
-
# Uncomment below to force Rails into production mode when
|
4
|
-
# you don't control web/app server and can't set it the proper way
|
5
|
-
# ENV['RAILS_ENV'] ||= 'production'
|
6
|
-
|
7
|
-
# Specifies gem version of Rails to use when vendor/rails is not present
|
8
|
-
RAILS_GEM_VERSION = '1.2.3'
|
9
|
-
|
10
|
-
# Bootstrap the Rails environment, frameworks, and default configuration
|
11
|
-
require File.join(File.dirname(__FILE__), 'boot')
|
12
|
-
|
13
|
-
Rails::Initializer.run do |config|
|
14
|
-
# Settings in config/environments/* take precedence those specified here
|
15
|
-
|
16
|
-
# Skip frameworks you're not going to use (only works if using vendor/rails)
|
17
|
-
# config.frameworks -= [ :action_web_service, :action_mailer ]
|
18
|
-
|
19
|
-
# Add additional load paths for your own custom dirs
|
20
|
-
# config.load_paths += %W( #{RAILS_ROOT}/extras )
|
21
|
-
|
22
|
-
# Force all environments to use the same logger level
|
23
|
-
# (by default production uses :info, the others :debug)
|
24
|
-
# config.log_level = :debug
|
25
|
-
|
26
|
-
# Use the database for sessions instead of the file system
|
27
|
-
# (create the session table with 'rake db:sessions:create')
|
28
|
-
# config.action_controller.session_store = :active_record_store
|
29
|
-
|
30
|
-
# Use SQL instead of Active Record's schema dumper when creating the test database.
|
31
|
-
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
32
|
-
# like if you have constraints or database-specific column types
|
33
|
-
# config.active_record.schema_format = :sql
|
34
|
-
|
35
|
-
# Activate observers that should always be running
|
36
|
-
# config.active_record.observers = :cacher, :garbage_collector
|
37
|
-
|
38
|
-
# Make Active Record use UTC-base instead of local time
|
39
|
-
# config.active_record.default_timezone = :utc
|
40
|
-
|
41
|
-
# See Rails::Configuration for more options
|
42
|
-
end
|
43
|
-
|
44
|
-
# Add new inflection rules using the following format
|
45
|
-
# (all these examples are active by default):
|
46
|
-
# Inflector.inflections do |inflect|
|
47
|
-
# inflect.plural /^(ox)$/i, '\1en'
|
48
|
-
# inflect.singular /^(ox)en/i, '\1'
|
49
|
-
# inflect.irregular 'person', 'people'
|
50
|
-
# inflect.uncountable %w( fish sheep )
|
51
|
-
# end
|
52
|
-
|
53
|
-
# Include your application configuration below
|
@@ -1,19 +0,0 @@
|
|
1
|
-
# Settings specified here will take precedence over those in config/environment.rb
|
2
|
-
|
3
|
-
# The test environment is used exclusively to run your application's
|
4
|
-
# test suite. You never need to work with it otherwise. Remember that
|
5
|
-
# your test database is "scratch space" for the test suite and is wiped
|
6
|
-
# and recreated between test runs. Don't rely on the data there!
|
7
|
-
config.cache_classes = true
|
8
|
-
|
9
|
-
# Log error messages when you accidentally call methods on nil.
|
10
|
-
config.whiny_nils = true
|
11
|
-
|
12
|
-
# Show full error reports and disable caching
|
13
|
-
config.action_controller.consider_all_requests_local = true
|
14
|
-
config.action_controller.perform_caching = false
|
15
|
-
|
16
|
-
# Tell ActionMailer not to deliver emails to the real world.
|
17
|
-
# The :test delivery method accumulates sent emails in the
|
18
|
-
# ActionMailer::Base.deliveries array.
|
19
|
-
config.action_mailer.delivery_method = :test
|
@@ -1,22 +0,0 @@
|
|
1
|
-
ActionController::Routing::Routes.draw do |map|
|
2
|
-
# The priority is based upon order of creation: first created -> highest priority.
|
3
|
-
|
4
|
-
# Sample of regular route:
|
5
|
-
# map.connect 'products/:id', :controller => 'catalog', :action => 'view'
|
6
|
-
# Keep in mind you can assign values other than :controller and :action
|
7
|
-
|
8
|
-
# Sample of named route:
|
9
|
-
# map.purchase 'products/:id/purchase', :controller => 'catalog', :action => 'purchase'
|
10
|
-
# This route can be invoked with purchase_url(:id => product.id)
|
11
|
-
|
12
|
-
# You can have the root of your site routed by hooking up ''
|
13
|
-
# -- just remember to delete public/index.html.
|
14
|
-
# map.connect '', :controller => "welcome"
|
15
|
-
|
16
|
-
# Allow downloading Web Service WSDL as a file with an extension
|
17
|
-
# instead of a file named 'wsdl'
|
18
|
-
map.connect ':controller/service.wsdl', :action => 'wsdl'
|
19
|
-
|
20
|
-
# Install the default route as the lowest priority.
|
21
|
-
map.connect ':controller/:action/:id'
|
22
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
testing:
|
2
|
-
id: 1
|
3
|
-
name: Testing Rails Applications
|
4
|
-
author_id: 1
|
5
|
-
|
6
|
-
deploying:
|
7
|
-
id: 2
|
8
|
-
name: Deploying Rails Applications
|
9
|
-
author_id: 2
|
10
|
-
|
11
|
-
donkies:
|
12
|
-
id: 3
|
13
|
-
name: What about the donkies?
|
14
|
-
author_id: 2
|
15
|
-
|
16
|
-
whales:
|
17
|
-
id: 4
|
18
|
-
name: Won't somebody think of the whales?
|
19
|
-
author_id: 2
|
@@ -1,18 +0,0 @@
|
|
1
|
-
class Author < ActiveRecord::Base
|
2
|
-
has_many :edits
|
3
|
-
end
|
4
|
-
|
5
|
-
class Edit < ActiveRecord::Base
|
6
|
-
belongs_to :author
|
7
|
-
belongs_to :article
|
8
|
-
end
|
9
|
-
|
10
|
-
class Article < ActiveRecord::Base
|
11
|
-
has_many :edits
|
12
|
-
has_many :editors, :through => :edits, :source => :author
|
13
|
-
belongs_to :author
|
14
|
-
|
15
|
-
def self.find_with_scope(options={}, &block)
|
16
|
-
with_scope(:find => options, &block)
|
17
|
-
end
|
18
|
-
end
|
@@ -1,33 +0,0 @@
|
|
1
|
-
ENV["RAILS_ENV"] = "test"
|
2
|
-
require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
|
3
|
-
require 'test_help'
|
4
|
-
|
5
|
-
class Test::Unit::TestCase
|
6
|
-
# Transactional fixtures accelerate your tests by wrapping each test method
|
7
|
-
# in a transaction that's rolled back on completion. This ensures that the
|
8
|
-
# test database remains unchanged so your fixtures don't have to be reloaded
|
9
|
-
# between every test method. Fewer database queries means faster tests.
|
10
|
-
#
|
11
|
-
# Read Mike Clark's excellent walkthrough at
|
12
|
-
# http://clarkware.com/cgi/blosxom/2005/10/24#Rails10FastTesting
|
13
|
-
#
|
14
|
-
# Every Active Record database supports transactions except MyISAM tables
|
15
|
-
# in MySQL. Turn off transactional fixtures in this case; however, if you
|
16
|
-
# don't care one way or the other, switching from MyISAM to InnoDB tables
|
17
|
-
# is recommended.
|
18
|
-
self.use_transactional_fixtures = true
|
19
|
-
|
20
|
-
# Instantiated fixtures are slow, but give you @david where otherwise you
|
21
|
-
# would need people(:david). If you don't want to migrate your existing
|
22
|
-
# test cases which use the @david style and don't mind the speed hit (each
|
23
|
-
# instantiated fixtures translates to a database query per test method),
|
24
|
-
# then set this back to true.
|
25
|
-
self.use_instantiated_fixtures = false
|
26
|
-
|
27
|
-
# Add more helper methods to be used by all tests here...
|
28
|
-
|
29
|
-
def setup
|
30
|
-
RAILS_DEFAULT_LOGGER.debug "\n\e[0;31mRUNNING TEST CASE: #{name}\e[m\n"
|
31
|
-
end
|
32
|
-
|
33
|
-
end
|