post_clerk 0.4 → 0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +66 -21
  3. data/.travis.yml +10 -0
  4. data/Gemfile +34 -3
  5. data/Gemfile.lock +334 -0
  6. data/Guardfile +2 -4
  7. data/README.md +11 -6
  8. data/Rakefile +10 -12
  9. data/lib/office_clerk/post.rb +21 -16
  10. data/lib/post_clerk.rb +1 -1
  11. data/post_clerk.gemspec +2 -2
  12. data/spec/controllers/orders_controller_spec.rb +59 -0
  13. data/spec/features/orders_spec.rb +32 -0
  14. data/spec/lib/post_spec.rb +84 -85
  15. data/spec/spec_helper.rb +27 -29
  16. data/spec/support/admin.rb +4 -0
  17. data/spec/support/capybara.rb +14 -0
  18. data/spec/support/cleaner.rb +22 -0
  19. data/spec/support/email.rb +6 -0
  20. data/spec/support/request_helper.rb +31 -0
  21. data/test_app/README.rdoc +28 -0
  22. data/test_app/app/assets/javascripts/application.js +15 -0
  23. data/test_app/app/assets/stylesheets/application.css +13 -0
  24. data/test_app/app/controllers/application_controller.rb +5 -0
  25. data/test_app/app/helpers/application_helper.rb +2 -0
  26. data/test_app/app/views/layouts/sales_clerk.haml +9 -0
  27. data/test_app/bin/bundle +3 -0
  28. data/test_app/bin/rails +4 -0
  29. data/test_app/bin/rake +4 -0
  30. data/test_app/config/application.rb +30 -0
  31. data/test_app/config/boot.rb +4 -0
  32. data/test_app/config/database.yml +25 -0
  33. data/test_app/config/environment.rb +5 -0
  34. data/test_app/config/environments/development.rb +32 -0
  35. data/test_app/config/environments/production.rb +80 -0
  36. data/test_app/config/environments/test.rb +39 -0
  37. data/test_app/config/initializers/backtrace_silencers.rb +7 -0
  38. data/test_app/config/initializers/filter_parameter_logging.rb +4 -0
  39. data/test_app/config/initializers/inflections.rb +16 -0
  40. data/test_app/config/initializers/mime_types.rb +5 -0
  41. data/test_app/config/initializers/secret_token.rb +12 -0
  42. data/test_app/config/initializers/session_store.rb +3 -0
  43. data/test_app/config/initializers/wrap_parameters.rb +14 -0
  44. data/test_app/config/locales/config.yml +22 -0
  45. data/test_app/config/locales/en.yml +2 -0
  46. data/test_app/config/routes.rb +4 -0
  47. data/test_app/config.ru +4 -0
  48. data/test_app/db/migrate/20141114205525_clerks.office.rb +16 -0
  49. data/test_app/db/migrate/20141114205526_suppliers.office.rb +10 -0
  50. data/test_app/db/migrate/20141114205527_categories.office.rb +19 -0
  51. data/test_app/db/migrate/20141114205528_items.office.rb +15 -0
  52. data/test_app/db/migrate/20141114205529_orders.office.rb +23 -0
  53. data/test_app/db/migrate/20141114205530_baskets.office.rb +13 -0
  54. data/test_app/db/migrate/20141114205531_purchases.office.rb +12 -0
  55. data/test_app/db/migrate/20141114205532_products.office.rb +28 -0
  56. data/test_app/db/schema.rb +141 -0
  57. data/test_app/db/seeds.rb +7 -0
  58. data/test_app/log/development.log +0 -0
  59. data/test_app/public/404.html +58 -0
  60. data/test_app/public/422.html +58 -0
  61. data/test_app/public/500.html +57 -0
  62. data/test_app/public/favicon.ico +0 -0
  63. data/test_app/public/robots.txt +5 -0
  64. metadata +64 -6
  65. data/config/locales/en.yml +0 -12
@@ -0,0 +1,59 @@
1
+ require 'spec_helper'
2
+
3
+ describe OrdersController do
4
+ routes { OfficeClerk::Engine.routes }
5
+
6
+ before :all do
7
+ create :admin unless Clerk.where(:admin => true).first
8
+ end
9
+
10
+ # This should return the minimal set of values that should be in the session
11
+ # in order to pass any filters (e.g. authentication) defined in
12
+ # SuppliersController. Be sure to keep this updated too.
13
+ let(:valid_session) { { :clerk_email => Clerk.where(:admin => true).first.email } }
14
+
15
+ describe "GET index" do
16
+ it "assigns all orders as @orders" do
17
+
18
+ count_before = Order.count
19
+ basket = create :order
20
+ get :index, {}, valid_session
21
+ expect(assigns(:order_scope).count).to be count_before + 1
22
+ end
23
+ end
24
+
25
+ describe "GET show" do
26
+ it "assigns the requested order as @order" do
27
+ order = create :order
28
+ get :show, {:id => order.to_param}, valid_session
29
+ expect(assigns(:order)).to eq(order)
30
+ end
31
+ end
32
+
33
+ describe "GET new" do
34
+ it "assigns a new order as @order" do
35
+ get :new, {}, valid_session
36
+ expect(assigns(:order)).to be_kind_of(Order)
37
+ end
38
+ end
39
+
40
+ describe "PUT update" do
41
+ describe "with valid params" do
42
+ it "assigns the requested order as @order" do
43
+ order = create :order
44
+ put :update, {:id => order.to_param, :order => attributes_for(:order)}, valid_session
45
+ expect(assigns(:order)).to eq(order)
46
+ end
47
+ end
48
+
49
+ describe "with invalid params" do
50
+ it "assigns the order as @order" do
51
+ order = create :order
52
+ # Trigger the behavior that occurs when invalid params are submitted
53
+ #allow(order).to receive(:save).and_return(false)
54
+ put :update, {:id => order.to_param, :order => { :paid_on => ""}}, valid_session
55
+ expect(assigns(:order)).to eq(order)
56
+ end
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,32 @@
1
+ require 'spec_helper'
2
+
3
+ describe "Orders" do
4
+ before(:each) do
5
+ sign_in
6
+ end
7
+ it "lists orders" do
8
+ visit_path orders_path
9
+ end
10
+ it "should render" do
11
+ order = create :order
12
+ visit_path order_path order
13
+ end
14
+ it "creates order from basket" do
15
+ basket = create(:basket_with_item)
16
+ visit_path edit_basket_path(basket)
17
+ find(".make_order").click
18
+ ensure_path order_path(basket.reload.kori)
19
+ end
20
+ it "orders a order" do
21
+ order = create(:order_ordered)
22
+ visit_path order_path(order)
23
+ find(".pay_now").click
24
+ end
25
+ it "inventories a order" do
26
+ order = create(:order_paid)
27
+ visit_path order_path(order)
28
+ start = order.basket.items.first.product.inventory
29
+ find(".ship_now").click
30
+ # expect(order.basket.items.first.product.inventory).to be order.basket.items.first.quantity
31
+ end
32
+ end
@@ -1,115 +1,114 @@
1
+ require "spec_helper"
2
+
1
3
  RSpec.describe OfficeClerk::Post do
2
4
 
3
- subject { described_class.new }
5
+ describe 'using the default weight-price table: [1 2 5 10 20] => [2 5 10 15 18]' do
6
+ context '.handling fee' do
7
+ it 'gives handling fee plus min price with defaults and 0 items' do
8
+ basket = create :basket
9
+ result = price_for_basket(basket , :handling_fee => 10)
10
+ expect(result).to eq(12.0)
11
+ end
4
12
 
5
- context 'returns description' do
6
- %w(en fi).each do |locale|
7
- it "in supported language: #{locale}" do
8
- I18n.with_locale(locale.to_sym) do
9
- expect(described_class.description).to eq I18n.t(:postal_service)
10
- end
13
+ it 'gives handling fee plus min price with defaults and 1 items' do
14
+ basket = create :basket_with_item
15
+ result = price_for_basket(basket , :handling_fee => 5)
16
+ expect(result).to eq(7.0)
11
17
  end
12
- end
13
- end
14
18
 
15
- describe 'using the default weight-price table: [1 2 5 10 20] => [6 9 12 15 18]' do
16
- context '.compute(package)' do
17
- it 'gives 15.0 when total price is 100 and weight is 10kg' do
18
- create_our_package(weight: 10.0, price: 100.0, quantity: 1)
19
- result = subject.compute(@basket)
19
+ it 'gives no handling fee just min price with defaults and 1 items' do
20
+ basket = create :basket_with_item
21
+ result = price_for_basket(basket )
22
+ expect(result).to eq(2.0)
23
+ end
24
+ end
25
+ context "free shipping " do
26
+ it "gives 0 for more than 100 cost, default setting " do
27
+ basket = basket_with({:weight => 10.0} , { price: 110.0} )
28
+ result = price_for_basket(basket)
29
+ expect(result).to eq(0.0)
30
+ end
31
+ it "gives non 0 for less than 100 cost, default setting " do
32
+ basket = basket_with({:weight => 10.0} , { price: 90.0} )
33
+ result = price_for_basket(basket)
20
34
  expect(result).to eq(15.0)
21
35
  end
22
-
23
- it 'gives 25.0 when total price is 40 and weight is 10kg' do
24
- create_our_package(weight: 10.0, price: 40.0, quantity: 1)
25
- result = subject.compute(@basket)
26
- expect(result).to eq(25.0)
36
+ it 'gives 0 when total price is more than the MAX, for one item (different max)' do
37
+ basket = basket_with({:weight => 15.0} , {:price => 350} )
38
+ result = price_for_basket(basket , :max_price => 300.0)
39
+ expect(result).to eq(0.0)
40
+ end
41
+ end
42
+ context '.price_for(basket)' do
43
+ it 'gives next price for 1.5 kg item => 5' do
44
+ basket = basket_with({:weight => 1.5} )
45
+ result = price_for_basket(basket)
46
+ expect(result).to eq(5.0)
27
47
  end
28
48
 
29
- it 'gives 6 when total price is 60 and weight is less than 1kg' do
30
- create_our_package(weight: 0.5, price: 60.0, quantity: 1)
31
- result = subject.compute(@basket)
32
- expect(result).to eq(6.0)
49
+ it 'gives next price for 2.5 kg item => 10' do
50
+ basket = basket_with({:weight => 2.5} )
51
+ result = price_for_basket(basket)
52
+ expect(result).to eq(10.0)
33
53
  end
34
54
 
35
- it 'gives 16 when total price is 40 and weight is less than 1kg' do
36
- create_our_package(weight: 0.5, price: 40.0, quantity: 1)
37
- result = subject.compute(@basket)
38
- expect(result).to eq(16.0)
55
+ it 'gives 15.0 when total price is 100 and weight is 10kg' do
56
+ basket = basket_with({:weight => 10.0} )
57
+ result = price_for_basket(basket)
58
+ expect(result).to eq(15.0)
39
59
  end
40
60
 
41
- it 'gives 30 when total price is 200 and weight is 25kg (split into two)' do
42
- create_our_package(weight: 25.0, price: 200.0, quantity: 1)
43
- subject.preferred_max_price = 250
44
- result = subject.compute(@basket)
45
- expect(result).to eq(30.0)
61
+ it 'gives 15.0 when total price is 40 and weight is 10kg' do
62
+ basket = basket_with({:weight => 10.0} , { price: 40.0} )
63
+ result = price_for_basket(basket)
64
+ expect(result).to eq(15.0)
46
65
  end
47
66
 
48
- it 'gives 12 when total price is 100, there are three items and their weight is unknown' do
49
- order = create(:order)
50
- variant = create(:base_variant, weight: nil)
51
- [30.0, 40.0, 30.0].each { |price| create_line_item(order, variant, price: price) }
52
- order.line_items.reload
53
- package = create(:shipment, order: order)
54
- result = subject.compute(package)
55
- expect(result).to eq(12.0)
67
+ it 'gives 6 when total price is 60 and weight is less than 1kg' do
68
+ basket = basket_with({:weight => 0.5} , { price: 60.0} )
69
+ result = price_for_basket(basket)
70
+ expect(result).to eq(2.0)
56
71
  end
57
72
 
58
- it 'gives 0 when total price is more than the MAX, for any number of items' do
59
- create_our_package(weight: 25.0, price: 350.0, quantity: 1)
60
- subject.preferred_max_price = 300
61
- result = subject.compute(@basket)
62
- expect(result).to eq(0.0)
73
+ it 'gives 30 when total price is 200 and weight is 25kg (split into two)' do
74
+ basket = basket_with({:weight => 25.0} , {:price => 200.0} )
75
+ result = price_for_basket(basket , :max_price => 250)
76
+ expect(result).to eq(28.0)
63
77
  end
64
78
  end
65
79
  end
66
80
 
67
- describe 'when preferred max weight, length and width are 18 kg, 120 cm and 60 cm' do
81
+ describe 'when preferred max is 20 kg' do
68
82
  context '.available?(package)' do
69
- it 'is false when item weighs more than 18kg' do
70
- create_our_package(weight: 20, height: 70, width: 30, depth: 30)
71
- expect(subject.available?(@basket)).to be(false)
72
- end
73
-
74
- it 'is false when item is longer than 120cm' do
75
- create_our_package(weight: 10, height: 130, width: 30, depth: 30)
76
- expect(subject.available?(@basket)).to be(false)
77
- end
78
-
79
- it 'is false when item is wider than 60cm' do
80
- create_our_package(weight: 10, height: 80, width: 70, depth: 30)
81
- expect(subject.available?(@basket)).to be(false)
83
+ it 'is false when item weighs more than 20kg' do
84
+ basket = basket_with(:weight => 25 )
85
+ expect(OfficeClerk::Post.new({}).available?(basket)).to be(false)
82
86
  end
83
87
  end
88
+ end
89
+
90
+ def basket_with product = {}, item = {}
91
+ basket = create :basket_with_item
92
+ basket.items.first.product.update_attributes!(product)
93
+ basket.items.first.update_attributes!(item)
94
+ basket.cache_total #TODO after save hook does not work to automatically update the totals
95
+ basket
96
+ end
97
+ def price_for_basket(basket , args = {})
98
+ OfficeClerk::Post.new(args).price_for(basket)
99
+ end
84
100
 
85
- context '.item_oversized?(variant)' do
86
- it 'is true if the longest side is more than 120cm' do
87
- create_our_package(weight: 10, height: 130, width: 40, depth: 30)
88
- expect(subject.item_oversized?(@variant)).to be(true)
89
- end
90
-
91
- it 'is true if the second longest side is more than 60cm' do
92
- create_our_package(weight: 10, height: 80, width: 70, depth: 30)
93
- expect(subject.item_oversized?(@variant)).to be(true)
101
+ context 'returns description' do
102
+ %w(en fi).each do |locale|
103
+ it "in supported language: #{locale}" do
104
+ I18n.with_locale(locale.to_sym) do
105
+ OfficeClerk::ShippingMethod.all.each do |name , method|
106
+ expect(method.description).not_to be_blank
107
+ expect(method.description).not_to include("missing")
108
+ end
109
+ end
94
110
  end
95
111
  end
96
112
  end
97
113
 
98
- def create_our_package(args = {})
99
- @variant = create :base_variant, args.except!(:quantity)
100
- order = create :order
101
- create_line_item(order, @variant, args)
102
- order.line_items.reload
103
- @basket = create :shipment, order: order
104
- end
105
-
106
- def create_line_item(order, variant, args = {})
107
- create(
108
- :line_item,
109
- price: args[:price] || BigDecimal.new('10.00'),
110
- quantity: args[:quantity] || 1,
111
- order: order,
112
- variant: variant
113
- )
114
- end
115
114
  end
data/spec/spec_helper.rb CHANGED
@@ -1,40 +1,38 @@
1
- require 'simplecov'
2
- require 'coveralls'
3
- SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
4
- SimpleCov::Formatter::HTMLFormatter,
5
- Coveralls::SimpleCov::Formatter
6
- ]
7
- SimpleCov.start do
8
- add_filter '/.bundle'
9
- add_filter '/spec/'
10
- add_filter '/lib/post_clerk/engine'
11
- add_group 'Libraries', 'lib'
1
+ if ENV['CODECLIMATE_REPO_TOKEN']
2
+ require "codeclimate-test-reporter"
3
+ CodeClimate::TestReporter.start
12
4
  end
13
5
 
14
- ENV['RAILS_ENV'] ||= 'test'
6
+ # This file is copied to spec/ when you run 'rails generate rspec:install'
7
+ ENV["RAILS_ENV"] = 'test'
8
+ require File.expand_path("../../test_app/config/environment", __FILE__)
9
+ Rails.backtrace_cleaner.remove_silencers!
15
10
 
16
- require File.expand_path('../dummy/config/environment.rb', __FILE__)
17
-
18
- require 'pry'
19
- require 'ffaker'
20
11
  require 'rspec/rails'
21
12
 
22
- ActiveRecord::Migration.maintain_test_schema!
23
- ActiveRecord::Migration.check_pending!
13
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
24
14
 
25
- RSpec.configure do |config|
26
15
 
27
- config.fail_fast = false
28
- config.filter_run focus: true
29
- config.run_all_when_everything_filtered = true
16
+ RSpec.configure do |config|
17
+
18
+ config.include PageHelper
19
+
20
+ config.include OfficeClerk::Engine.routes.url_helpers
30
21
 
31
- config.mock_with :rspec
32
- config.raise_errors_for_deprecations!
22
+ config.infer_base_class_for_anonymous_controllers = false
33
23
  config.infer_spec_type_from_file_location!
34
-
35
- config.expect_with :rspec do |expectations|
36
- expectations.syntax = :expect
24
+
25
+ # Run specs in random order to surface order dependencies. If you find an
26
+ # order dependency and want to debug it, you can fix the order by providing
27
+ # the seed, which is printed after each run.
28
+ # --seed 1234
29
+ config.order = "random"
30
+
31
+ if config.files_to_run.one?
32
+ config.default_formatter = 'doc'
37
33
  end
38
- end
39
34
 
40
- Dir[File.join(File.dirname(__FILE__), 'support/**/*.rb')].each { |file| require file }
35
+ # Print the 10 slowest examples and example groups at the end of the spec run,
36
+ #to help surface which specs are running particularly slow.
37
+ # config.profile_examples = 10
38
+ end
@@ -0,0 +1,4 @@
1
+ unless Clerk.where( :email => "admin@important.me").first
2
+ admin = Clerk.new( :email => "admin@important.me" , :admin => true , :password => "password" )
3
+ admin.save!
4
+ end
@@ -0,0 +1,14 @@
1
+ require 'capybara/rspec'
2
+ require 'capybara-screenshot/rspec'
3
+ Capybara::Screenshot.prune_strategy = :keep_last_run
4
+
5
+ #require 'capybara/poltergeist'
6
+ #Capybara.javascript_driver = :poltergeist
7
+
8
+ Capybara.default_selector = :css
9
+
10
+ RSpec.configure do |config|
11
+
12
+ config.include Capybara::DSL
13
+
14
+ end
@@ -0,0 +1,22 @@
1
+ require "database_cleaner"
2
+
3
+ RSpec.configure do |config|
4
+ config.use_transactional_fixtures = false
5
+ config.before(:suite) do
6
+ DatabaseCleaner.clean_with :truncation
7
+ DatabaseCleaner.strategy = :transaction
8
+ end
9
+ config.before(:each) do |group|
10
+ DatabaseCleaner.strategy = :transaction
11
+ end
12
+
13
+ config.before(:each, :js => true) do
14
+ DatabaseCleaner.strategy = :truncation
15
+ end
16
+ config.before(:each) do
17
+ DatabaseCleaner.start
18
+ end
19
+ config.after(:each) do
20
+ DatabaseCleaner.clean
21
+ end
22
+ end
@@ -0,0 +1,6 @@
1
+ require 'email_spec'
2
+
3
+ RSpec.configure do |config|
4
+ config.include(EmailSpec::Helpers)
5
+ config.include(EmailSpec::Matchers)
6
+ end
@@ -0,0 +1,31 @@
1
+ module PageHelper
2
+ def ensure_path path
3
+ expect(page.current_path).to eq path
4
+ end
5
+ def visit_path path
6
+ visit path
7
+ expect(status_code).to be 200
8
+ expect(page).not_to have_css(".translation_missing")
9
+ ensure_path path
10
+ end
11
+
12
+ def ensure_admin
13
+ admin = Clerk.where(:admin => true).first
14
+ admin = create :admin unless admin
15
+ expect(admin).not_to be nil
16
+ admin
17
+ end
18
+
19
+ def sign_in
20
+ admin = ensure_admin
21
+ visit sign_in_path
22
+ fill_in "email" , :with => admin.email
23
+ fill_in "password" , :with => "password"
24
+ click_button I18n.t(:sign_in)
25
+ expect(page).to have_content I18n.t(:baskets)
26
+ end
27
+
28
+ def expect_basket_total price
29
+ expect(find(".total").text).to include( price.round(2).to_s.sub(".",",")) # TODO remove the format hack
30
+ end
31
+ end
@@ -0,0 +1,28 @@
1
+ == README
2
+
3
+ This README would normally document whatever steps are necessary to get the
4
+ application up and running.
5
+
6
+ Things you may want to cover:
7
+
8
+ * Ruby version
9
+
10
+ * System dependencies
11
+
12
+ * Configuration
13
+
14
+ * Database creation
15
+
16
+ * Database initialization
17
+
18
+ * How to run the test suite
19
+
20
+ * Services (job queues, cache servers, search engines, etc.)
21
+
22
+ * Deployment instructions
23
+
24
+ * ...
25
+
26
+
27
+ Please feel free to use a different markup language if you do not plan to run
28
+ <tt>rake doc:app</tt>.
@@ -0,0 +1,15 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // compiled file.
9
+ //
10
+ // Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
11
+ // about supported directives.
12
+ //
13
+ //= require jquery
14
+ //= require jquery_ujs
15
+ //= require_tree .
@@ -0,0 +1,13 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the top of the
9
+ * compiled file, but it's generally better to create a new file per style scope.
10
+ *
11
+ *= require_self
12
+ *= require_tree .
13
+ */
@@ -0,0 +1,5 @@
1
+ class ApplicationController < ActionController::Base
2
+ # Prevent CSRF attacks by raising an exception.
3
+ # For APIs, you may want to use :null_session instead.
4
+ protect_from_forgery with: :exception
5
+ end
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
@@ -0,0 +1,9 @@
1
+ !!!
2
+ %html
3
+ %head
4
+ %title TestApp
5
+ = stylesheet_link_tag "application", media: "all"
6
+ = javascript_include_tag "application"
7
+ = csrf_meta_tags
8
+ %body
9
+ = yield
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3
+ load Gem.bin_path('bundler', 'bundle')
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
3
+ require_relative '../config/boot'
4
+ require 'rails/commands'
data/test_app/bin/rake ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require_relative '../config/boot'
3
+ require 'rake'
4
+ Rake.application.run
@@ -0,0 +1,30 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ # Pick the frameworks you want:
4
+ require "active_record/railtie"
5
+ require "action_controller/railtie"
6
+ require "action_mailer/railtie"
7
+ require "sprockets/railtie"
8
+ # require "rails/test_unit/railtie"
9
+
10
+ # Require the gems listed in Gemfile, including any gems
11
+ # you've limited to :test, :development, or :production.
12
+ Bundler.require(*Rails.groups)
13
+
14
+ module TestApp
15
+ class Application < Rails::Application
16
+ # Settings in config/environments/* take precedence over those specified here.
17
+ # Application configuration should go into files in config/initializers
18
+ # -- all .rb files in that directory are automatically loaded.
19
+
20
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
21
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
22
+ # config.time_zone = 'Central Time (US & Canada)'
23
+
24
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
25
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
26
+ # config.i18n.default_locale = :de
27
+
28
+ config.active_record.raise_in_transactional_callbacks = true
29
+ end
30
+ end
@@ -0,0 +1,4 @@
1
+ # Set up gems listed in the Gemfile.
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../Gemfile', __FILE__)
3
+
4
+ require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
@@ -0,0 +1,25 @@
1
+ # SQLite version 3.x
2
+ # gem install sqlite3
3
+ #
4
+ # Ensure the SQLite 3 gem is defined in your Gemfile
5
+ # gem 'sqlite3'
6
+ development:
7
+ adapter: sqlite3
8
+ database: db/development.sqlite3
9
+ pool: 5
10
+ timeout: 5000
11
+
12
+ # Warning: The database defined as "test" will be erased and
13
+ # re-generated from your development database when you run "rake".
14
+ # Do not set this db to the same as development or production.
15
+ test:
16
+ adapter: sqlite3
17
+ database: db/test.sqlite3
18
+ pool: 5
19
+ timeout: 5000
20
+
21
+ production:
22
+ adapter: sqlite3
23
+ database: db/production.sqlite3
24
+ pool: 5
25
+ timeout: 5000
@@ -0,0 +1,5 @@
1
+ # Load the Rails application.
2
+ require File.expand_path('../application', __FILE__)
3
+
4
+ # Initialize the Rails application.
5
+ TestApp::Application.initialize!
@@ -0,0 +1,32 @@
1
+ TestApp::Application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb.
3
+
4
+ # In the development environment your application's code is reloaded on
5
+ # every request. This slows down response time but is perfect for development
6
+ # since you don't have to restart the web server when you make code changes.
7
+ config.cache_classes = false
8
+
9
+ # Do not eager load code on boot.
10
+ config.eager_load = false
11
+
12
+ # Show full error reports and disable caching.
13
+ config.consider_all_requests_local = true
14
+ config.action_controller.perform_caching = false
15
+
16
+ # Don't care if the mailer can't send.
17
+ config.action_mailer.raise_delivery_errors = false
18
+
19
+ # Print deprecation notices to the Rails logger.
20
+ config.active_support.deprecation = :log
21
+
22
+ # Raise an error on page load if there are pending migrations
23
+ config.active_record.migration_error = :page_load
24
+
25
+ # Debug mode disables concatenation and preprocessing of assets.
26
+ # This option may cause significant delays in view rendering with a large
27
+ # number of complex assets.
28
+ config.assets.debug = true
29
+
30
+ # Raises error for missing translations
31
+ # config.action_view.raise_on_missing_translations = true
32
+ end