document_number 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +3 -0
- data/Rakefile +21 -0
- data/lib/document_number/document_number.rb +4 -0
- data/lib/document_number/has_document_number.rb +35 -0
- data/lib/document_number/numerator.rb +17 -0
- data/lib/document_number/version.rb +3 -0
- data/lib/document_number.rb +9 -0
- data/lib/generators/document_number/install/install_generator.rb +20 -0
- data/lib/generators/document_number/install/templates/create_document_numbers.rb +10 -0
- data/spec/dummy/README.rdoc +28 -0
- data/spec/dummy/Rakefile +6 -0
- data/spec/dummy/app/assets/javascripts/application.js +13 -0
- data/spec/dummy/app/assets/stylesheets/application.css +15 -0
- data/spec/dummy/app/controllers/application_controller.rb +5 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/models/inventory.rb +3 -0
- data/spec/dummy/app/models/invoice.rb +3 -0
- data/spec/dummy/app/models/price_adjustment.rb +3 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/config/application.rb +23 -0
- data/spec/dummy/config/boot.rb +5 -0
- data/spec/dummy/config/database.yml +25 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +37 -0
- data/spec/dummy/config/environments/production.rb +83 -0
- data/spec/dummy/config/environments/test.rb +39 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +16 -0
- data/spec/dummy/config/initializers/mime_types.rb +4 -0
- data/spec/dummy/config/initializers/session_store.rb +3 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +23 -0
- data/spec/dummy/config/routes.rb +56 -0
- data/spec/dummy/config/secrets.yml +22 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/migrate/20140610080445_create_document_numbers.rb +10 -0
- data/spec/dummy/db/migrate/20140610090526_create_inventories.rb +9 -0
- data/spec/dummy/db/migrate/20140610093227_create_invoices.rb +9 -0
- data/spec/dummy/db/migrate/20140610093243_create_price_adjustments.rb +9 -0
- data/spec/dummy/db/schema.rb +42 -0
- data/spec/dummy/log/development.log +96 -0
- data/spec/dummy/public/404.html +67 -0
- data/spec/dummy/public/422.html +67 -0
- data/spec/dummy/public/500.html +66 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/models/inventory_spec.rb +19 -0
- data/spec/models/invoices_spec.rb +8 -0
- data/spec/models/price_adjustment_spec.rb +13 -0
- data/spec/spec_helper.rb +18 -0
- 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"] %>
|
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,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
|
+
[1m[36m (1.2ms)[0m [1mCREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) [0m
|
2
|
+
[1m[35m (0.5ms)[0m select sqlite_version(*)
|
3
|
+
[1m[36m (0.9ms)[0m [1mCREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")[0m
|
4
|
+
[1m[35mActiveRecord::SchemaMigration Load (0.1ms)[0m SELECT "schema_migrations".* FROM "schema_migrations"
|
5
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.5ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
6
|
+
Migrating to CreateDocumentNumbers (20140610080445)
|
7
|
+
[1m[35m (0.1ms)[0m begin transaction
|
8
|
+
[1m[36m (0.5ms)[0m [1mCREATE TABLE "document_numbers" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "document" varchar(255), "number" integer NOT NULL, "created_at" datetime) [0m
|
9
|
+
[1m[35m (0.6ms)[0m select sqlite_version(*)
|
10
|
+
[1m[36m (0.2ms)[0m [1mCREATE INDEX "index_document_numbers_on_document" ON "document_numbers" ("document")[0m
|
11
|
+
[1m[35mSQL (0.4ms)[0m INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20140610080445"]]
|
12
|
+
[1m[36m (1.0ms)[0m [1mcommit transaction[0m
|
13
|
+
Migrating to CreateInventories (20140610090526)
|
14
|
+
[1m[35m (0.1ms)[0m begin transaction
|
15
|
+
[1m[36m (0.6ms)[0m [1mCREATE TABLE "inventories" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "number" varchar(255), "created_at" datetime, "updated_at" datetime) [0m
|
16
|
+
[1m[35mSQL (0.2ms)[0m INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20140610090526"]]
|
17
|
+
[1m[36m (0.8ms)[0m [1mcommit transaction[0m
|
18
|
+
[1m[35mActiveRecord::SchemaMigration Load (0.1ms)[0m SELECT "schema_migrations".* FROM "schema_migrations"
|
19
|
+
[1m[36m (0.1ms)[0m [1m 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
|
+
[0m
|
27
|
+
[1m[36m (1.2ms)[0m [1mCREATE TABLE "document_numbers" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "document" varchar(255), "number" integer NOT NULL, "created_at" datetime) [0m
|
28
|
+
[1m[35m (0.1ms)[0m select sqlite_version(*)
|
29
|
+
[1m[36m (0.9ms)[0m [1mCREATE INDEX "index_document_numbers_on_document" ON "document_numbers" ("document")[0m
|
30
|
+
[1m[35m (0.9ms)[0m CREATE TABLE "inventories" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "number" varchar(255), "created_at" datetime, "updated_at" datetime)
|
31
|
+
[1m[36m (0.9ms)[0m [1mCREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) [0m
|
32
|
+
[1m[35m (0.8ms)[0m CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
|
33
|
+
[1m[36m (0.1ms)[0m [1mSELECT version FROM "schema_migrations"[0m
|
34
|
+
[1m[35m (0.9ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20140610090526')
|
35
|
+
[1m[36m (0.9ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('20140610080445')[0m
|
36
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
37
|
+
[1m[35mDocumentNumber::DocumentNumber Load (0.5ms)[0m SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'inventory' LIMIT 1
|
38
|
+
[1m[36mSQL (1.1ms)[0m [1mINSERT INTO "document_numbers" ("created_at", "document") VALUES (?, ?)[0m [["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
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
41
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
42
|
+
[1m[35mDocumentNumber::DocumentNumber Load (0.1ms)[0m SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'inventory' LIMIT 1
|
43
|
+
[1m[36mSQL (0.4ms)[0m [1mINSERT INTO "document_numbers" ("created_at", "document") VALUES (?, ?)[0m [["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
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
46
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
47
|
+
[1m[35mDocumentNumber::DocumentNumber Load (0.1ms)[0m SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'inventory' LIMIT 1
|
48
|
+
[1m[36mSQL (0.3ms)[0m [1mINSERT INTO "document_numbers" ("created_at", "document") VALUES (?, ?)[0m [["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
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
51
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
52
|
+
[1m[35mDocumentNumber::DocumentNumber Load (0.1ms)[0m SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'inventory' LIMIT 1
|
53
|
+
[1m[36mSQL (0.3ms)[0m [1mINSERT INTO "document_numbers" ("created_at", "document") VALUES (?, ?)[0m [["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
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
56
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
57
|
+
[1m[35mDocumentNumber::DocumentNumber Load (0.1ms)[0m SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'inventory' LIMIT 1
|
58
|
+
[1m[36mSQL (0.4ms)[0m [1mINSERT INTO "document_numbers" ("created_at", "document") VALUES (?, ?)[0m [["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
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
61
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
62
|
+
[1m[35mDocumentNumber::DocumentNumber Load (0.1ms)[0m SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'inventory' LIMIT 1
|
63
|
+
[1m[36mSQL (0.3ms)[0m [1mINSERT INTO "document_numbers" ("created_at", "document") VALUES (?, ?)[0m [["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
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
66
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
67
|
+
[1m[35mDocumentNumber::DocumentNumber Load (0.1ms)[0m SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'inventory' LIMIT 1
|
68
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
69
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
70
|
+
[1m[35mDocumentNumber::DocumentNumber Load (0.1ms)[0m SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'inventory' LIMIT 1
|
71
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
72
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
73
|
+
[1m[35mDocumentNumber::DocumentNumber Load (0.1ms)[0m SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'inventory' LIMIT 1
|
74
|
+
[1m[36mSQL (0.7ms)[0m [1mINSERT INTO "document_numbers" ("created_at", "document", "number") VALUES (?, ?, ?)[0m [["created_at", "2014-06-10 09:27:56.377650"], ["document", "inventory"], ["number", 1]]
|
75
|
+
[1m[35mSQL (0.6ms)[0m 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
|
+
[1m[36m (0.8ms)[0m [1mcommit transaction[0m
|
77
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.5ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
78
|
+
Migrating to CreateInvoices (20140610093227)
|
79
|
+
[1m[35m (0.1ms)[0m begin transaction
|
80
|
+
[1m[36m (0.5ms)[0m [1mCREATE TABLE "invoices" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "number" varchar(255), "created_at" datetime, "updated_at" datetime) [0m
|
81
|
+
[1m[35mSQL (0.3ms)[0m INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20140610093227"]]
|
82
|
+
[1m[36m (0.7ms)[0m [1mcommit transaction[0m
|
83
|
+
Migrating to CreatePriceAdjustments (20140610093243)
|
84
|
+
[1m[35m (0.1ms)[0m begin transaction
|
85
|
+
[1m[36m (0.4ms)[0m [1mCREATE TABLE "price_adjustments" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "document_number" varchar(255), "created_at" datetime, "updated_at" datetime) [0m
|
86
|
+
[1m[35mSQL (0.2ms)[0m INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20140610093243"]]
|
87
|
+
[1m[36m (0.8ms)[0m [1mcommit transaction[0m
|
88
|
+
[1m[35mActiveRecord::SchemaMigration Load (0.1ms)[0m SELECT "schema_migrations".* FROM "schema_migrations"
|
89
|
+
[1m[36m (0.2ms)[0m [1m 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
|
+
[0m
|
@@ -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,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
|
data/spec/spec_helper.rb
ADDED
@@ -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
|