document_number 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.rdoc +3 -0
  4. data/Rakefile +21 -0
  5. data/lib/document_number/document_number.rb +4 -0
  6. data/lib/document_number/has_document_number.rb +35 -0
  7. data/lib/document_number/numerator.rb +17 -0
  8. data/lib/document_number/version.rb +3 -0
  9. data/lib/document_number.rb +9 -0
  10. data/lib/generators/document_number/install/install_generator.rb +20 -0
  11. data/lib/generators/document_number/install/templates/create_document_numbers.rb +10 -0
  12. data/spec/dummy/README.rdoc +28 -0
  13. data/spec/dummy/Rakefile +6 -0
  14. data/spec/dummy/app/assets/javascripts/application.js +13 -0
  15. data/spec/dummy/app/assets/stylesheets/application.css +15 -0
  16. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  17. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  18. data/spec/dummy/app/models/inventory.rb +3 -0
  19. data/spec/dummy/app/models/invoice.rb +3 -0
  20. data/spec/dummy/app/models/price_adjustment.rb +3 -0
  21. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  22. data/spec/dummy/bin/bundle +3 -0
  23. data/spec/dummy/bin/rails +4 -0
  24. data/spec/dummy/bin/rake +4 -0
  25. data/spec/dummy/config/application.rb +23 -0
  26. data/spec/dummy/config/boot.rb +5 -0
  27. data/spec/dummy/config/database.yml +25 -0
  28. data/spec/dummy/config/environment.rb +5 -0
  29. data/spec/dummy/config/environments/development.rb +37 -0
  30. data/spec/dummy/config/environments/production.rb +83 -0
  31. data/spec/dummy/config/environments/test.rb +39 -0
  32. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  33. data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
  34. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  35. data/spec/dummy/config/initializers/inflections.rb +16 -0
  36. data/spec/dummy/config/initializers/mime_types.rb +4 -0
  37. data/spec/dummy/config/initializers/session_store.rb +3 -0
  38. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  39. data/spec/dummy/config/locales/en.yml +23 -0
  40. data/spec/dummy/config/routes.rb +56 -0
  41. data/spec/dummy/config/secrets.yml +22 -0
  42. data/spec/dummy/config.ru +4 -0
  43. data/spec/dummy/db/development.sqlite3 +0 -0
  44. data/spec/dummy/db/migrate/20140610080445_create_document_numbers.rb +10 -0
  45. data/spec/dummy/db/migrate/20140610090526_create_inventories.rb +9 -0
  46. data/spec/dummy/db/migrate/20140610093227_create_invoices.rb +9 -0
  47. data/spec/dummy/db/migrate/20140610093243_create_price_adjustments.rb +9 -0
  48. data/spec/dummy/db/schema.rb +42 -0
  49. data/spec/dummy/log/development.log +96 -0
  50. data/spec/dummy/public/404.html +67 -0
  51. data/spec/dummy/public/422.html +67 -0
  52. data/spec/dummy/public/500.html +66 -0
  53. data/spec/dummy/public/favicon.ico +0 -0
  54. data/spec/models/inventory_spec.rb +19 -0
  55. data/spec/models/invoices_spec.rb +8 -0
  56. data/spec/models/price_adjustment_spec.rb +13 -0
  57. data/spec/spec_helper.rb +18 -0
  58. metadata +273 -0
@@ -0,0 +1,56 @@
1
+ Rails.application.routes.draw do
2
+ # The priority is based upon order of creation: first created -> highest priority.
3
+ # See how all your routes lay out with "rake routes".
4
+
5
+ # You can have the root of your site routed with "root"
6
+ # root 'welcome#index'
7
+
8
+ # Example of regular route:
9
+ # get 'products/:id' => 'catalog#view'
10
+
11
+ # Example of named route that can be invoked with purchase_url(id: product.id)
12
+ # get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
13
+
14
+ # Example resource route (maps HTTP verbs to controller actions automatically):
15
+ # resources :products
16
+
17
+ # Example resource route with options:
18
+ # resources :products do
19
+ # member do
20
+ # get 'short'
21
+ # post 'toggle'
22
+ # end
23
+ #
24
+ # collection do
25
+ # get 'sold'
26
+ # end
27
+ # end
28
+
29
+ # Example resource route with sub-resources:
30
+ # resources :products do
31
+ # resources :comments, :sales
32
+ # resource :seller
33
+ # end
34
+
35
+ # Example resource route with more complex sub-resources:
36
+ # resources :products do
37
+ # resources :comments
38
+ # resources :sales do
39
+ # get 'recent', on: :collection
40
+ # end
41
+ # end
42
+
43
+ # Example resource route with concerns:
44
+ # concern :toggleable do
45
+ # post 'toggle'
46
+ # end
47
+ # resources :posts, concerns: :toggleable
48
+ # resources :photos, concerns: :toggleable
49
+
50
+ # Example resource route within a namespace:
51
+ # namespace :admin do
52
+ # # Directs /admin/products/* to Admin::ProductsController
53
+ # # (app/controllers/admin/products_controller.rb)
54
+ # resources :products
55
+ # end
56
+ end
@@ -0,0 +1,22 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Your secret key is used for verifying the integrity of signed cookies.
4
+ # If you change this key, all old signed cookies will become invalid!
5
+
6
+ # Make sure the secret is at least 30 characters and all random,
7
+ # no regular words or you'll be exposed to dictionary attacks.
8
+ # You can use `rake secret` to generate a secure secret key.
9
+
10
+ # Make sure the secrets in this file are kept private
11
+ # if you're sharing your code publicly.
12
+
13
+ development:
14
+ secret_key_base: 5d5582d5ee718ace36e5172c0a2efecdfc2e59ec28618dc9706f2c9ab2b86549a0dd28fa60597caa26f4fc1430a7fd7687acf1148738e5085d374764ed9f6961
15
+
16
+ test:
17
+ secret_key_base: 62a6bed3cf97465661bed46cdbcef1a6c3b8828f7e8841711754d48957162b64acff5423c001447bf121674fb0a6f3272ea0e2d9fef684792139fdb537f06d00
18
+
19
+ # Do not keep production secrets in the repository,
20
+ # instead read values from the environment.
21
+ production:
22
+ secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
@@ -0,0 +1,4 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
+ run Rails.application
Binary file
@@ -0,0 +1,10 @@
1
+ class CreateDocumentNumbers < ActiveRecord::Migration
2
+ def change
3
+ create_table :document_numbers do |t|
4
+ t.string :document
5
+ t.integer :number, null: false, default: 0
6
+ t.datetime :created_at
7
+ end
8
+ add_index :document_numbers, :document, unique: true
9
+ end
10
+ end
@@ -0,0 +1,9 @@
1
+ class CreateInventories < ActiveRecord::Migration
2
+ def change
3
+ create_table :inventories do |t|
4
+ t.string :number
5
+
6
+ t.timestamps
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ class CreateInvoices < ActiveRecord::Migration
2
+ def change
3
+ create_table :invoices do |t|
4
+ t.string :number
5
+
6
+ t.timestamps
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ class CreatePriceAdjustments < ActiveRecord::Migration
2
+ def change
3
+ create_table :price_adjustments do |t|
4
+ t.string :document_number
5
+
6
+ t.timestamps
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,42 @@
1
+ # encoding: UTF-8
2
+ # This file is auto-generated from the current state of the database. Instead
3
+ # of editing this file, please use the migrations feature of Active Record to
4
+ # incrementally modify your database, and then regenerate this schema definition.
5
+ #
6
+ # Note that this schema.rb definition is the authoritative source for your
7
+ # database schema. If you need to create the application database on another
8
+ # system, you should be using db:schema:load, not running all the migrations
9
+ # from scratch. The latter is a flawed and unsustainable approach (the more migrations
10
+ # you'll amass, the slower it'll run and the greater likelihood for issues).
11
+ #
12
+ # It's strongly recommended that you check this file into your version control system.
13
+
14
+ ActiveRecord::Schema.define(version: 20140610093243) do
15
+
16
+ create_table "document_numbers", force: true do |t|
17
+ t.string "document"
18
+ t.integer "number", null: false, default: 0
19
+ t.datetime "created_at"
20
+ end
21
+
22
+ add_index "document_numbers", ["document"], name: "index_document_numbers_on_document", unique: true
23
+
24
+ create_table "inventories", force: true do |t|
25
+ t.string "number"
26
+ t.datetime "created_at"
27
+ t.datetime "updated_at"
28
+ end
29
+
30
+ create_table "invoices", force: true do |t|
31
+ t.string "number"
32
+ t.datetime "created_at"
33
+ t.datetime "updated_at"
34
+ end
35
+
36
+ create_table "price_adjustments", force: true do |t|
37
+ t.string "document_number"
38
+ t.datetime "created_at"
39
+ t.datetime "updated_at"
40
+ end
41
+
42
+ end
@@ -0,0 +1,96 @@
1
+  (1.2ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
2
+  (0.5ms) select sqlite_version(*)
3
+  (0.9ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
4
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
5
+ ActiveRecord::SchemaMigration Load (0.5ms) SELECT "schema_migrations".* FROM "schema_migrations"
6
+ Migrating to CreateDocumentNumbers (20140610080445)
7
+  (0.1ms) begin transaction
8
+  (0.5ms) CREATE TABLE "document_numbers" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "document" varchar(255), "number" integer NOT NULL, "created_at" datetime) 
9
+  (0.6ms) select sqlite_version(*)
10
+  (0.2ms) CREATE INDEX "index_document_numbers_on_document" ON "document_numbers" ("document")
11
+ SQL (0.4ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20140610080445"]]
12
+  (1.0ms) commit transaction
13
+ Migrating to CreateInventories (20140610090526)
14
+  (0.1ms) begin transaction
15
+  (0.6ms) CREATE TABLE "inventories" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "number" varchar(255), "created_at" datetime, "updated_at" datetime) 
16
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20140610090526"]]
17
+  (0.8ms) commit transaction
18
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
19
+  (0.1ms)  SELECT sql
20
+ FROM sqlite_master
21
+ WHERE name='index_document_numbers_on_document' AND type='index'
22
+ UNION ALL
23
+ SELECT sql
24
+ FROM sqlite_temp_master
25
+ WHERE name='index_document_numbers_on_document' AND type='index'
26
+ 
27
+  (1.2ms) CREATE TABLE "document_numbers" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "document" varchar(255), "number" integer NOT NULL, "created_at" datetime) 
28
+  (0.1ms) select sqlite_version(*)
29
+  (0.9ms) CREATE INDEX "index_document_numbers_on_document" ON "document_numbers" ("document")
30
+  (0.9ms) CREATE TABLE "inventories" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "number" varchar(255), "created_at" datetime, "updated_at" datetime)
31
+  (0.9ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
32
+  (0.8ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
33
+  (0.1ms) SELECT version FROM "schema_migrations"
34
+  (0.9ms) INSERT INTO "schema_migrations" (version) VALUES ('20140610090526')
35
+  (0.9ms) INSERT INTO "schema_migrations" (version) VALUES ('20140610080445')
36
+  (0.1ms) begin transaction
37
+ DocumentNumber::DocumentNumber Load (0.5ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'inventory' LIMIT 1
38
+ SQL (1.1ms) INSERT INTO "document_numbers" ("created_at", "document") VALUES (?, ?) [["created_at", "2014-06-10 09:18:56.241431"], ["document", "inventory"]]
39
+ SQLite3::ConstraintException: document_numbers.number may not be NULL: INSERT INTO "document_numbers" ("created_at", "document") VALUES (?, ?)
40
+  (0.1ms) rollback transaction
41
+  (0.1ms) begin transaction
42
+ DocumentNumber::DocumentNumber Load (0.1ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'inventory' LIMIT 1
43
+ SQL (0.4ms) INSERT INTO "document_numbers" ("created_at", "document") VALUES (?, ?) [["created_at", "2014-06-10 09:20:10.581165"], ["document", "inventory"]]
44
+ SQLite3::ConstraintException: document_numbers.number may not be NULL: INSERT INTO "document_numbers" ("created_at", "document") VALUES (?, ?)
45
+  (0.1ms) rollback transaction
46
+  (0.1ms) begin transaction
47
+ DocumentNumber::DocumentNumber Load (0.1ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'inventory' LIMIT 1
48
+ SQL (0.3ms) INSERT INTO "document_numbers" ("created_at", "document") VALUES (?, ?) [["created_at", "2014-06-10 09:21:51.772208"], ["document", "inventory"]]
49
+ SQLite3::ConstraintException: document_numbers.number may not be NULL: INSERT INTO "document_numbers" ("created_at", "document") VALUES (?, ?)
50
+  (0.1ms) rollback transaction
51
+  (0.1ms) begin transaction
52
+ DocumentNumber::DocumentNumber Load (0.1ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'inventory' LIMIT 1
53
+ SQL (0.3ms) INSERT INTO "document_numbers" ("created_at", "document") VALUES (?, ?) [["created_at", "2014-06-10 09:23:16.436527"], ["document", "inventory"]]
54
+ SQLite3::ConstraintException: document_numbers.number may not be NULL: INSERT INTO "document_numbers" ("created_at", "document") VALUES (?, ?)
55
+  (0.1ms) rollback transaction
56
+  (0.1ms) begin transaction
57
+ DocumentNumber::DocumentNumber Load (0.1ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'inventory' LIMIT 1
58
+ SQL (0.4ms) INSERT INTO "document_numbers" ("created_at", "document") VALUES (?, ?) [["created_at", "2014-06-10 09:25:04.242710"], ["document", "inventory"]]
59
+ SQLite3::ConstraintException: document_numbers.number may not be NULL: INSERT INTO "document_numbers" ("created_at", "document") VALUES (?, ?)
60
+  (0.1ms) rollback transaction
61
+  (0.1ms) begin transaction
62
+ DocumentNumber::DocumentNumber Load (0.1ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'inventory' LIMIT 1
63
+ SQL (0.3ms) INSERT INTO "document_numbers" ("created_at", "document") VALUES (?, ?) [["created_at", "2014-06-10 09:25:41.982941"], ["document", "inventory"]]
64
+ SQLite3::ConstraintException: document_numbers.number may not be NULL: INSERT INTO "document_numbers" ("created_at", "document") VALUES (?, ?)
65
+  (0.1ms) rollback transaction
66
+  (0.1ms) begin transaction
67
+ DocumentNumber::DocumentNumber Load (0.1ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'inventory' LIMIT 1
68
+  (0.1ms) rollback transaction
69
+  (0.1ms) begin transaction
70
+ DocumentNumber::DocumentNumber Load (0.1ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'inventory' LIMIT 1
71
+  (0.1ms) rollback transaction
72
+  (0.1ms) begin transaction
73
+ DocumentNumber::DocumentNumber Load (0.1ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'inventory' LIMIT 1
74
+ SQL (0.7ms) INSERT INTO "document_numbers" ("created_at", "document", "number") VALUES (?, ?, ?) [["created_at", "2014-06-10 09:27:56.377650"], ["document", "inventory"], ["number", 1]]
75
+ SQL (0.6ms) INSERT INTO "inventories" ("created_at", "number", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-06-10 09:27:56.365557"], ["number", "1"], ["updated_at", "2014-06-10 09:27:56.365557"]]
76
+  (0.8ms) commit transaction
77
+ ActiveRecord::SchemaMigration Load (0.5ms) SELECT "schema_migrations".* FROM "schema_migrations"
78
+ Migrating to CreateInvoices (20140610093227)
79
+  (0.1ms) begin transaction
80
+  (0.5ms) CREATE TABLE "invoices" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "number" varchar(255), "created_at" datetime, "updated_at" datetime) 
81
+ SQL (0.3ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20140610093227"]]
82
+  (0.7ms) commit transaction
83
+ Migrating to CreatePriceAdjustments (20140610093243)
84
+  (0.1ms) begin transaction
85
+  (0.4ms) CREATE TABLE "price_adjustments" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "document_number" varchar(255), "created_at" datetime, "updated_at" datetime) 
86
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20140610093243"]]
87
+  (0.8ms) commit transaction
88
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
89
+  (0.2ms)  SELECT sql
90
+ FROM sqlite_master
91
+ WHERE name='index_document_numbers_on_document' AND type='index'
92
+ UNION ALL
93
+ SELECT sql
94
+ FROM sqlite_temp_master
95
+ WHERE name='index_document_numbers_on_document' AND type='index'
96
+ 
@@ -0,0 +1,67 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The page you were looking for doesn't exist (404)</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ body {
8
+ background-color: #EFEFEF;
9
+ color: #2E2F30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+
15
+ div.dialog {
16
+ width: 95%;
17
+ max-width: 33em;
18
+ margin: 4em auto 0;
19
+ }
20
+
21
+ div.dialog > div {
22
+ border: 1px solid #CCC;
23
+ border-right-color: #999;
24
+ border-left-color: #999;
25
+ border-bottom-color: #BBB;
26
+ border-top: #B00100 solid 4px;
27
+ border-top-left-radius: 9px;
28
+ border-top-right-radius: 9px;
29
+ background-color: white;
30
+ padding: 7px 12% 0;
31
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
+ }
33
+
34
+ h1 {
35
+ font-size: 100%;
36
+ color: #730E15;
37
+ line-height: 1.5em;
38
+ }
39
+
40
+ div.dialog > p {
41
+ margin: 0 0 1em;
42
+ padding: 1em;
43
+ background-color: #F7F7F7;
44
+ border: 1px solid #CCC;
45
+ border-right-color: #999;
46
+ border-left-color: #999;
47
+ border-bottom-color: #999;
48
+ border-bottom-left-radius: 4px;
49
+ border-bottom-right-radius: 4px;
50
+ border-top-color: #DADADA;
51
+ color: #666;
52
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
+ }
54
+ </style>
55
+ </head>
56
+
57
+ <body>
58
+ <!-- This file lives in public/404.html -->
59
+ <div class="dialog">
60
+ <div>
61
+ <h1>The page you were looking for doesn't exist.</h1>
62
+ <p>You may have mistyped the address or the page may have moved.</p>
63
+ </div>
64
+ <p>If you are the application owner check the logs for more information.</p>
65
+ </div>
66
+ </body>
67
+ </html>
@@ -0,0 +1,67 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The change you wanted was rejected (422)</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ body {
8
+ background-color: #EFEFEF;
9
+ color: #2E2F30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+
15
+ div.dialog {
16
+ width: 95%;
17
+ max-width: 33em;
18
+ margin: 4em auto 0;
19
+ }
20
+
21
+ div.dialog > div {
22
+ border: 1px solid #CCC;
23
+ border-right-color: #999;
24
+ border-left-color: #999;
25
+ border-bottom-color: #BBB;
26
+ border-top: #B00100 solid 4px;
27
+ border-top-left-radius: 9px;
28
+ border-top-right-radius: 9px;
29
+ background-color: white;
30
+ padding: 7px 12% 0;
31
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
+ }
33
+
34
+ h1 {
35
+ font-size: 100%;
36
+ color: #730E15;
37
+ line-height: 1.5em;
38
+ }
39
+
40
+ div.dialog > p {
41
+ margin: 0 0 1em;
42
+ padding: 1em;
43
+ background-color: #F7F7F7;
44
+ border: 1px solid #CCC;
45
+ border-right-color: #999;
46
+ border-left-color: #999;
47
+ border-bottom-color: #999;
48
+ border-bottom-left-radius: 4px;
49
+ border-bottom-right-radius: 4px;
50
+ border-top-color: #DADADA;
51
+ color: #666;
52
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
+ }
54
+ </style>
55
+ </head>
56
+
57
+ <body>
58
+ <!-- This file lives in public/422.html -->
59
+ <div class="dialog">
60
+ <div>
61
+ <h1>The change you wanted was rejected.</h1>
62
+ <p>Maybe you tried to change something you didn't have access to.</p>
63
+ </div>
64
+ <p>If you are the application owner check the logs for more information.</p>
65
+ </div>
66
+ </body>
67
+ </html>
@@ -0,0 +1,66 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ body {
8
+ background-color: #EFEFEF;
9
+ color: #2E2F30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+
15
+ div.dialog {
16
+ width: 95%;
17
+ max-width: 33em;
18
+ margin: 4em auto 0;
19
+ }
20
+
21
+ div.dialog > div {
22
+ border: 1px solid #CCC;
23
+ border-right-color: #999;
24
+ border-left-color: #999;
25
+ border-bottom-color: #BBB;
26
+ border-top: #B00100 solid 4px;
27
+ border-top-left-radius: 9px;
28
+ border-top-right-radius: 9px;
29
+ background-color: white;
30
+ padding: 7px 12% 0;
31
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
+ }
33
+
34
+ h1 {
35
+ font-size: 100%;
36
+ color: #730E15;
37
+ line-height: 1.5em;
38
+ }
39
+
40
+ div.dialog > p {
41
+ margin: 0 0 1em;
42
+ padding: 1em;
43
+ background-color: #F7F7F7;
44
+ border: 1px solid #CCC;
45
+ border-right-color: #999;
46
+ border-left-color: #999;
47
+ border-bottom-color: #999;
48
+ border-bottom-left-radius: 4px;
49
+ border-bottom-right-radius: 4px;
50
+ border-top-color: #DADADA;
51
+ color: #666;
52
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
+ }
54
+ </style>
55
+ </head>
56
+
57
+ <body>
58
+ <!-- This file lives in public/500.html -->
59
+ <div class="dialog">
60
+ <div>
61
+ <h1>We're sorry, but something went wrong.</h1>
62
+ </div>
63
+ <p>If you are the application owner check the logs for more information.</p>
64
+ </div>
65
+ </body>
66
+ </html>
File without changes
@@ -0,0 +1,19 @@
1
+ require 'spec_helper'
2
+
3
+ describe Inventory do
4
+ it 'sets number on create' do
5
+ inventory = Inventory.create
6
+ expect(inventory.number).not_to be_nil
7
+ end
8
+
9
+ it 'creates with own number' do
10
+ inventory = Inventory.create number: '5'
11
+ expect(inventory.number).to eq('5')
12
+ end
13
+
14
+ it 'does not change number on update' do
15
+ inventory = Inventory.create number: '5'
16
+ inventory.touch
17
+ expect(inventory.number).to eq('5')
18
+ end
19
+ end
@@ -0,0 +1,8 @@
1
+ require 'spec_helper'
2
+
3
+ describe Invoice do
4
+ it 'sets number on create with prefix' do
5
+ invoice = Invoice.create
6
+ expect(invoice.number).to eq('invoice/1')
7
+ end
8
+ end
@@ -0,0 +1,13 @@
1
+ require 'spec_helper'
2
+
3
+ describe PriceAdjustment do
4
+ it 'uses non-default column' do
5
+ price_adjustment = PriceAdjustment.create
6
+ expect(price_adjustment.document_number).not_to be_nil
7
+ end
8
+
9
+ it 'starts from predefined value' do
10
+ price_adjustment = PriceAdjustment.create
11
+ expect(price_adjustment.document_number).to eq('501')
12
+ end
13
+ end
@@ -0,0 +1,18 @@
1
+ ENV['RAILS_ENV'] ||= 'test'
2
+
3
+ require File.expand_path("../dummy/config/environment.rb", __FILE__)
4
+ require 'rspec/rails'
5
+ require 'minitest/autorun'
6
+ # require 'factory_girl_rails'
7
+
8
+ Rails.backtrace_cleaner.remove_silencers!
9
+
10
+ # Load support files
11
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
12
+
13
+ RSpec.configure do |config|
14
+ config.mock_with :rspec
15
+ config.use_transactional_fixtures = true
16
+ config.infer_base_class_for_anonymous_controllers = false
17
+ config.order = "random"
18
+ end