document_number 0.9.4 → 0.9.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 75500243b3fd65038c8e538fc3b93a0b050edc11
4
- data.tar.gz: 86f25277e158d293587011577d2a00f4b05f5067
3
+ metadata.gz: 337c6198b0d348504c0abe65f01df91544724463
4
+ data.tar.gz: 5b0c85816bc4ebda39e8423e3410d98a7e546035
5
5
  SHA512:
6
- metadata.gz: baf9447bcee403a81f2c63e6db45f85faed39acadbfe305fbdd0eddb175e476ec440233144525c016e95d2f898f7487b089b22f5f4cda9509fe5563c0bf641c2
7
- data.tar.gz: ca400d03a1e1dd1a6a9f66ce6bcdee13729c8059ef2d1137ecda09cd56133bed33e61133d5d2fb850f803de41cc47c5b723a18b923de4027a269c71ceb728870
6
+ metadata.gz: e773f853519aeb24a66d37cfd809aeb6219ad51e86f32e3bf59d08e4822db6002fa1243bd0a64a692089e335d753bc811aa8c225b673ac08441795b3c6611c5e
7
+ data.tar.gz: 489b715a7f524030fef54e47ffef7bcfbab6476660bbbfe01a8561c70d5a685396af57a7a563b2fc9b83299048c651954c20222a5b98e5d97d7753dde38c5947
@@ -3,6 +3,7 @@ module DocumentNumber
3
3
 
4
4
  def self.included(base)
5
5
  base.send :extend, ClassMethods
6
+ attr_accessor :with_number
6
7
  end
7
8
 
8
9
  module ClassMethods
@@ -17,20 +18,38 @@ module DocumentNumber
17
18
  # :column the column name to update. Default value is `:number`.
18
19
  # :prefix the prefix for number.
19
20
  # :start the start value for number
21
+ #
22
+ # Use params `with_number` to create an object with predefined number
20
23
  def has_document_number(options = {})
21
24
  options.reverse_merge! :column => :number, :start => 1
22
25
 
26
+ class_attribute :document_number_options
27
+ self.document_number_options = options.dup
28
+
23
29
  method_name = "auto_increment_#{options[:column]}"
24
30
 
25
31
  before_create method_name
32
+ after_initialize method_name, :if => Proc.new { with_number == true }
26
33
 
27
34
  define_method method_name do
28
35
  return if send(options[:column]).present?
29
- number = Numerator.next_number(self, options)
36
+ number = Numerator.next_number(self.class.to_s.underscore, options)
30
37
  prefix = options[:prefix].present? ? options[:prefix] : ::DocumentNumber.configuration.prefix
31
38
  write_attribute options[:column], "#{prefix}#{number}"
32
39
  end
33
40
  end
41
+
42
+ # Use this with your model to obtain an array of numbers
43
+ #
44
+ # Usage:
45
+ # numbers = Invoice.get_numbers(100)
46
+ def get_numbers(quantity)
47
+ Array.new(Integer(quantity)) do
48
+ "#{document_number_options[:prefix]}#{Numerator.next_number(to_s.underscore, document_number_options)}"
49
+ end
50
+ rescue
51
+ []
52
+ end
34
53
  end
35
54
  end
36
55
  end
@@ -2,13 +2,13 @@ require "active_record/base"
2
2
 
3
3
  module DocumentNumber
4
4
  class Numerator
5
- def self.next_number(object, options)
6
- DocumentNumber.transaction do
7
- if ::Rails.version < "4.0"
8
- # Rails 3 support
9
- document_number = DocumentNumber.lock(true).find_or_initialize_by_document(object.class.to_s.underscore)
5
+ # Gets next number for document
6
+ def self.next_number(document, options)
7
+ DocumentNumber.transaction(requires_new: true) do
8
+ if ActiveRecord::VERSION::MAJOR < 4
9
+ document_number = DocumentNumber.lock(true).find_or_initialize_by_document(document)
10
10
  else
11
- document_number = DocumentNumber.lock(true).find_or_initialize_by(:document => object.class.to_s.underscore)
11
+ document_number = DocumentNumber.lock(true).find_or_initialize_by(:document => document)
12
12
  end
13
13
 
14
14
  number = document_number.number == 1 ? options[:start] : document_number.number
@@ -1,3 +1,3 @@
1
1
  module DocumentNumber
2
- VERSION = "0.9.4"
2
+ VERSION = "0.9.5"
3
3
  end
@@ -839,3 +839,789 @@
839
839
  SQL (0.1ms) INSERT INTO "invoices" ("created_at", "number", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-06-19 10:02:23.808669"], ["number", "invoice/1"], ["updated_at", "2014-06-19 10:02:23.808669"]]
840
840
   (0.1ms) RELEASE SAVEPOINT active_record_1
841
841
   (0.6ms) rollback transaction
842
+  (4.9ms) CREATE TABLE "document_numbers" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "document" varchar(255), "number" integer DEFAULT 1 NOT NULL, "created_at" datetime) 
843
+  (1.2ms) select sqlite_version(*)
844
+  (6.6ms) CREATE UNIQUE INDEX "index_document_numbers_on_document" ON "document_numbers" ("document")
845
+  (1.1ms) CREATE TABLE "inventories" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "number" varchar(255), "created_at" datetime, "updated_at" datetime)
846
+  (0.9ms) CREATE TABLE "invoices" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "number" varchar(255), "created_at" datetime, "updated_at" datetime) 
847
+  (0.9ms) CREATE TABLE "price_adjustments" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "document_number" varchar(255), "created_at" datetime, "updated_at" datetime)
848
+  (1.0ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
849
+  (0.9ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
850
+  (0.2ms) SELECT version FROM "schema_migrations"
851
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20140610093243')
852
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20140610080445')
853
+  (0.7ms) INSERT INTO "schema_migrations" (version) VALUES ('20140610090526')
854
+  (0.7ms) INSERT INTO "schema_migrations" (version) VALUES ('20140610093227')
855
+  (0.4ms) begin transaction
856
+  (0.0ms) SAVEPOINT active_record_1
857
+ DocumentNumber::DocumentNumber Load (0.1ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'invoice' LIMIT 1
858
+ SQL (0.4ms) INSERT INTO "document_numbers" ("created_at", "document", "number") VALUES (?, ?, ?) [["created_at", "2014-07-15 20:11:25.831725"], ["document", "invoice"], ["number", 2]]
859
+ SQL (0.1ms) INSERT INTO "invoices" ("created_at", "number", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-07-15 20:11:25.816393"], ["number", "invoice/1"], ["updated_at", "2014-07-15 20:11:25.816393"]]
860
+  (0.0ms) RELEASE SAVEPOINT active_record_1
861
+  (1.4ms) rollback transaction
862
+  (0.1ms) begin transaction
863
+  (0.1ms) SAVEPOINT active_record_1
864
+ DocumentNumber::DocumentNumber Load (0.1ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'inventory' LIMIT 1
865
+ SQL (0.3ms) INSERT INTO "document_numbers" ("created_at", "document", "number") VALUES (?, ?, ?) [["created_at", "2014-07-15 20:11:25.845955"], ["document", "inventory"], ["number", 2]]
866
+ SQL (0.1ms) INSERT INTO "inventories" ("created_at", "number", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-07-15 20:11:25.842219"], ["number", "1"], ["updated_at", "2014-07-15 20:11:25.842219"]]
867
+  (0.1ms) RELEASE SAVEPOINT active_record_1
868
+  (0.6ms) rollback transaction
869
+  (0.1ms) begin transaction
870
+  (0.1ms) SAVEPOINT active_record_1
871
+ SQL (0.3ms) INSERT INTO "inventories" ("created_at", "number", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-07-15 20:11:25.849688"], ["number", "500"], ["updated_at", "2014-07-15 20:11:25.849688"]]
872
+  (0.1ms) RELEASE SAVEPOINT active_record_1
873
+  (0.4ms) rollback transaction
874
+  (0.1ms) begin transaction
875
+  (0.0ms) SAVEPOINT active_record_1
876
+ DocumentNumber::DocumentNumber Load (0.2ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'inventory' LIMIT 1
877
+ SQL (0.2ms) INSERT INTO "document_numbers" ("created_at", "document", "number") VALUES (?, ?, ?) [["created_at", "2014-07-15 20:11:25.853375"], ["document", "inventory"], ["number", 2]]
878
+ SQL (0.1ms) INSERT INTO "inventories" ("created_at", "number", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-07-15 20:11:25.852195"], ["number", "1"], ["updated_at", "2014-07-15 20:11:25.852195"]]
879
+  (0.1ms) RELEASE SAVEPOINT active_record_1
880
+  (0.0ms) SAVEPOINT active_record_1
881
+ DocumentNumber::DocumentNumber Load (0.1ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'inventory' LIMIT 1
882
+ SQL (1.0ms) UPDATE "document_numbers" SET "number" = ? WHERE "document_numbers"."id" = 1 [["number", 3]]
883
+ SQL (0.1ms) INSERT INTO "inventories" ("created_at", "number", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-07-15 20:11:25.855214"], ["number", "2"], ["updated_at", "2014-07-15 20:11:25.855214"]]
884
+  (0.1ms) RELEASE SAVEPOINT active_record_1
885
+  (0.6ms) rollback transaction
886
+  (0.1ms) begin transaction
887
+  (0.1ms) SAVEPOINT active_record_1
888
+ SQL (0.4ms) INSERT INTO "inventories" ("created_at", "number", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-07-15 20:11:25.868765"], ["number", "5"], ["updated_at", "2014-07-15 20:11:25.868765"]]
889
+  (0.1ms) RELEASE SAVEPOINT active_record_1
890
+  (0.1ms) SAVEPOINT active_record_1
891
+ SQL (0.4ms) UPDATE "inventories" SET "updated_at" = '2014-07-15 20:11:25.870776' WHERE "inventories"."id" = 1
892
+  (0.1ms) RELEASE SAVEPOINT active_record_1
893
+  (0.5ms) rollback transaction
894
+  (0.1ms) begin transaction
895
+  (0.1ms) SAVEPOINT active_record_1
896
+ DocumentNumber::DocumentNumber Load (0.1ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'price_adjustment' LIMIT 1
897
+ SQL (0.4ms) INSERT INTO "document_numbers" ("created_at", "document", "number") VALUES (?, ?, ?) [["created_at", "2014-07-15 20:11:25.879910"], ["document", "price_adjustment"], ["number", 501]]
898
+ SQL (0.3ms) INSERT INTO "price_adjustments" ("created_at", "document_number", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-07-15 20:11:25.875744"], ["document_number", "500"], ["updated_at", "2014-07-15 20:11:25.875744"]]
899
+  (0.1ms) RELEASE SAVEPOINT active_record_1
900
+  (0.6ms) rollback transaction
901
+  (0.1ms) begin transaction
902
+  (0.0ms) SAVEPOINT active_record_1
903
+ DocumentNumber::DocumentNumber Load (0.2ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'price_adjustment' LIMIT 1
904
+ SQL (0.3ms) INSERT INTO "document_numbers" ("created_at", "document", "number") VALUES (?, ?, ?) [["created_at", "2014-07-15 20:11:25.886035"], ["document", "price_adjustment"], ["number", 501]]
905
+ SQL (0.1ms) INSERT INTO "price_adjustments" ("created_at", "document_number", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-07-15 20:11:25.884715"], ["document_number", "500"], ["updated_at", "2014-07-15 20:11:25.884715"]]
906
+  (0.1ms) RELEASE SAVEPOINT active_record_1
907
+  (0.5ms) rollback transaction
908
+  (0.1ms) begin transaction
909
+  (0.1ms) SAVEPOINT active_record_1
910
+ DocumentNumber::DocumentNumber Load (0.2ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'price_adjustment' LIMIT 1
911
+ SQL (0.3ms) INSERT INTO "document_numbers" ("created_at", "document", "number") VALUES (?, ?, ?) [["created_at", "2014-07-15 20:11:25.891014"], ["document", "price_adjustment"], ["number", 501]]
912
+ SQL (0.1ms) INSERT INTO "price_adjustments" ("created_at", "document_number", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-07-15 20:11:25.889677"], ["document_number", "500"], ["updated_at", "2014-07-15 20:11:25.889677"]]
913
+  (0.1ms) RELEASE SAVEPOINT active_record_1
914
+  (0.0ms) SAVEPOINT active_record_1
915
+ DocumentNumber::DocumentNumber Load (0.2ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'price_adjustment' LIMIT 1
916
+ SQL (0.3ms) UPDATE "document_numbers" SET "number" = ? WHERE "document_numbers"."id" = 1 [["number", 502]]
917
+ SQL (0.1ms) INSERT INTO "price_adjustments" ("created_at", "document_number", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-07-15 20:11:25.893640"], ["document_number", "501"], ["updated_at", "2014-07-15 20:11:25.893640"]]
918
+  (0.1ms) RELEASE SAVEPOINT active_record_1
919
+  (0.6ms) rollback transaction
920
+  (1.3ms) CREATE TABLE "document_numbers" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "document" varchar(255), "number" integer DEFAULT 1 NOT NULL, "created_at" datetime) 
921
+  (0.5ms) select sqlite_version(*)
922
+  (0.9ms) CREATE UNIQUE INDEX "index_document_numbers_on_document" ON "document_numbers" ("document")
923
+  (0.8ms) CREATE TABLE "inventories" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "number" varchar(255), "created_at" datetime, "updated_at" datetime)
924
+  (0.8ms) CREATE TABLE "invoices" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "number" varchar(255), "created_at" datetime, "updated_at" datetime) 
925
+  (0.9ms) CREATE TABLE "price_adjustments" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "document_number" varchar(255), "created_at" datetime, "updated_at" datetime)
926
+  (1.0ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
927
+  (1.1ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
928
+  (0.1ms) SELECT version FROM "schema_migrations"
929
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20140610093243')
930
+  (0.7ms) INSERT INTO "schema_migrations" (version) VALUES ('20140610080445')
931
+  (0.7ms) INSERT INTO "schema_migrations" (version) VALUES ('20140610090526')
932
+  (0.7ms) INSERT INTO "schema_migrations" (version) VALUES ('20140610093227')
933
+  (0.3ms) begin transaction
934
+  (0.1ms) SAVEPOINT active_record_1
935
+  (0.1ms) SAVEPOINT active_record_2
936
+ DocumentNumber::DocumentNumber Load (0.1ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'price_adjustment' LIMIT 1
937
+ SQL (0.4ms) INSERT INTO "document_numbers" ("created_at", "document", "number") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:39:46.019886"], ["document", "price_adjustment"], ["number", 501]]
938
+  (0.1ms) RELEASE SAVEPOINT active_record_2
939
+ SQL (0.1ms) INSERT INTO "price_adjustments" ("created_at", "document_number", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:39:46.002761"], ["document_number", "500"], ["updated_at", "2014-07-18 19:39:46.002761"]]
940
+  (0.0ms) RELEASE SAVEPOINT active_record_1
941
+  (0.1ms) SAVEPOINT active_record_1
942
+  (0.0ms) SAVEPOINT active_record_2
943
+ DocumentNumber::DocumentNumber Load (0.1ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'price_adjustment' LIMIT 1
944
+ SQL (1.0ms) UPDATE "document_numbers" SET "number" = ? WHERE "document_numbers"."id" = 1 [["number", 502]]
945
+  (0.1ms) RELEASE SAVEPOINT active_record_2
946
+ SQL (0.1ms) INSERT INTO "price_adjustments" ("created_at", "document_number", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:39:46.025904"], ["document_number", "501"], ["updated_at", "2014-07-18 19:39:46.025904"]]
947
+  (0.0ms) RELEASE SAVEPOINT active_record_1
948
+  (1.0ms) rollback transaction
949
+  (0.1ms) begin transaction
950
+  (0.1ms) SAVEPOINT active_record_1
951
+  (0.0ms) SAVEPOINT active_record_2
952
+ DocumentNumber::DocumentNumber Load (0.1ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'price_adjustment' LIMIT 1
953
+ SQL (0.4ms) INSERT INTO "document_numbers" ("created_at", "document", "number") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:39:46.033691"], ["document", "price_adjustment"], ["number", 501]]
954
+  (0.1ms) RELEASE SAVEPOINT active_record_2
955
+ SQL (0.1ms) INSERT INTO "price_adjustments" ("created_at", "document_number", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:39:46.032403"], ["document_number", "500"], ["updated_at", "2014-07-18 19:39:46.032403"]]
956
+  (0.1ms) RELEASE SAVEPOINT active_record_1
957
+  (0.4ms) rollback transaction
958
+  (0.1ms) begin transaction
959
+  (0.1ms) SAVEPOINT active_record_1
960
+  (0.1ms) SAVEPOINT active_record_2
961
+ DocumentNumber::DocumentNumber Load (0.2ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'price_adjustment' LIMIT 1
962
+ SQL (0.3ms) INSERT INTO "document_numbers" ("created_at", "document", "number") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:39:46.040113"], ["document", "price_adjustment"], ["number", 501]]
963
+  (0.1ms) RELEASE SAVEPOINT active_record_2
964
+ SQL (0.1ms) INSERT INTO "price_adjustments" ("created_at", "document_number", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:39:46.038382"], ["document_number", "500"], ["updated_at", "2014-07-18 19:39:46.038382"]]
965
+  (0.1ms) RELEASE SAVEPOINT active_record_1
966
+  (0.5ms) rollback transaction
967
+  (0.1ms) begin transaction
968
+  (0.0ms) SAVEPOINT active_record_1
969
+  (0.1ms) SAVEPOINT active_record_2
970
+ DocumentNumber::DocumentNumber Load (0.1ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'invoice' LIMIT 1
971
+ SQL (0.4ms) INSERT INTO "document_numbers" ("created_at", "document", "number") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:39:46.049829"], ["document", "invoice"], ["number", 2]]
972
+  (0.1ms) RELEASE SAVEPOINT active_record_2
973
+ SQL (0.1ms) INSERT INTO "invoices" ("created_at", "number", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:39:46.045690"], ["number", "invoice/1"], ["updated_at", "2014-07-18 19:39:46.045690"]]
974
+  (0.0ms) RELEASE SAVEPOINT active_record_1
975
+  (0.4ms) rollback transaction
976
+  (0.1ms) begin transaction
977
+  (0.1ms) SAVEPOINT active_record_1
978
+ DocumentNumber::DocumentNumber Load (0.2ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'inventory' LIMIT 1
979
+ SQL (0.3ms) INSERT INTO "document_numbers" ("created_at", "document", "number") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:39:46.055224"], ["document", "inventory"], ["number", 2]]
980
+  (0.1ms) RELEASE SAVEPOINT active_record_1
981
+  (0.1ms) SAVEPOINT active_record_1
982
+ DocumentNumber::DocumentNumber Load (0.1ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'inventory' LIMIT 1
983
+ SQL (0.4ms) UPDATE "document_numbers" SET "number" = ? WHERE "document_numbers"."id" = 1 [["number", 3]]
984
+  (0.1ms) RELEASE SAVEPOINT active_record_1
985
+  (0.1ms) SAVEPOINT active_record_1
986
+ DocumentNumber::DocumentNumber Load (0.1ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'inventory' LIMIT 1
987
+ SQL (0.1ms) UPDATE "document_numbers" SET "number" = ? WHERE "document_numbers"."id" = 1 [["number", 4]]
988
+  (0.1ms) RELEASE SAVEPOINT active_record_1
989
+  (0.6ms) rollback transaction
990
+  (0.1ms) begin transaction
991
+  (0.1ms) SAVEPOINT active_record_1
992
+ SQL (0.3ms) INSERT INTO "inventories" ("created_at", "number", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:39:46.066028"], ["number", "5"], ["updated_at", "2014-07-18 19:39:46.066028"]]
993
+  (0.1ms) RELEASE SAVEPOINT active_record_1
994
+  (0.1ms) SAVEPOINT active_record_1
995
+ SQL (0.5ms) UPDATE "inventories" SET "updated_at" = '2014-07-18 19:39:46.067978' WHERE "inventories"."id" = 1
996
+  (0.1ms) RELEASE SAVEPOINT active_record_1
997
+  (0.4ms) rollback transaction
998
+  (0.1ms) begin transaction
999
+  (0.0ms) SAVEPOINT active_record_1
1000
+ SQL (0.2ms) INSERT INTO "inventories" ("created_at", "number", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:39:46.070992"], ["number", "500"], ["updated_at", "2014-07-18 19:39:46.070992"]]
1001
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1002
+  (0.4ms) rollback transaction
1003
+  (0.1ms) begin transaction
1004
+  (0.1ms) SAVEPOINT active_record_1
1005
+  (0.1ms) SAVEPOINT active_record_2
1006
+ DocumentNumber::DocumentNumber Load (0.2ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'inventory' LIMIT 1
1007
+ SQL (0.2ms) INSERT INTO "document_numbers" ("created_at", "document", "number") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:39:46.075535"], ["document", "inventory"], ["number", 2]]
1008
+  (0.1ms) RELEASE SAVEPOINT active_record_2
1009
+ SQL (0.1ms) INSERT INTO "inventories" ("created_at", "number", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:39:46.074049"], ["number", "1"], ["updated_at", "2014-07-18 19:39:46.074049"]]
1010
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1011
+  (0.0ms) SAVEPOINT active_record_1
1012
+  (0.0ms) SAVEPOINT active_record_2
1013
+ DocumentNumber::DocumentNumber Load (0.1ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'inventory' LIMIT 1
1014
+ SQL (0.3ms) UPDATE "document_numbers" SET "number" = ? WHERE "document_numbers"."id" = 1 [["number", 3]]
1015
+  (0.0ms) RELEASE SAVEPOINT active_record_2
1016
+ SQL (0.1ms) INSERT INTO "inventories" ("created_at", "number", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:39:46.077718"], ["number", "2"], ["updated_at", "2014-07-18 19:39:46.077718"]]
1017
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1018
+  (0.5ms) rollback transaction
1019
+  (0.1ms) begin transaction
1020
+  (0.1ms) SAVEPOINT active_record_1
1021
+  (0.1ms) SAVEPOINT active_record_2
1022
+ DocumentNumber::DocumentNumber Load (0.6ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'inventory' LIMIT 1
1023
+ SQL (0.3ms) INSERT INTO "document_numbers" ("created_at", "document", "number") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:39:46.084936"], ["document", "inventory"], ["number", 2]]
1024
+  (0.1ms) RELEASE SAVEPOINT active_record_2
1025
+ SQL (0.1ms) INSERT INTO "inventories" ("created_at", "number", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:39:46.082262"], ["number", "1"], ["updated_at", "2014-07-18 19:39:46.082262"]]
1026
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1027
+  (0.5ms) rollback transaction
1028
+  (1.8ms) CREATE TABLE "document_numbers" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "document" varchar(255), "number" integer DEFAULT 1 NOT NULL, "created_at" datetime) 
1029
+  (0.1ms) select sqlite_version(*)
1030
+  (0.8ms) CREATE UNIQUE INDEX "index_document_numbers_on_document" ON "document_numbers" ("document")
1031
+  (0.9ms) CREATE TABLE "inventories" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "number" varchar(255), "created_at" datetime, "updated_at" datetime)
1032
+  (0.8ms) CREATE TABLE "invoices" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "number" varchar(255), "created_at" datetime, "updated_at" datetime) 
1033
+  (0.9ms) CREATE TABLE "price_adjustments" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "document_number" varchar(255), "created_at" datetime, "updated_at" datetime)
1034
+  (1.0ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
1035
+  (1.0ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
1036
+  (0.1ms) SELECT version FROM "schema_migrations"
1037
+  (0.9ms) INSERT INTO "schema_migrations" (version) VALUES ('20140610093243')
1038
+  (0.7ms) INSERT INTO "schema_migrations" (version) VALUES ('20140610080445')
1039
+  (0.7ms) INSERT INTO "schema_migrations" (version) VALUES ('20140610090526')
1040
+  (0.7ms) INSERT INTO "schema_migrations" (version) VALUES ('20140610093227')
1041
+  (0.4ms) begin transaction
1042
+  (0.0ms) SAVEPOINT active_record_1
1043
+  (0.1ms) SAVEPOINT active_record_2
1044
+ DocumentNumber::DocumentNumber Load (0.1ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'inventory' LIMIT 1
1045
+ SQL (0.4ms) INSERT INTO "document_numbers" ("created_at", "document", "number") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:42:34.032262"], ["document", "inventory"], ["number", 2]]
1046
+  (0.1ms) RELEASE SAVEPOINT active_record_2
1047
+ SQL (0.1ms) INSERT INTO "inventories" ("created_at", "number", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:42:34.008009"], ["number", "1"], ["updated_at", "2014-07-18 19:42:34.008009"]]
1048
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1049
+  (0.5ms) rollback transaction
1050
+  (0.1ms) begin transaction
1051
+  (0.0ms) SAVEPOINT active_record_1
1052
+ DocumentNumber::DocumentNumber Load (0.1ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'inventory' LIMIT 1
1053
+ SQL (0.2ms) INSERT INTO "document_numbers" ("created_at", "document", "number") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:42:34.039310"], ["document", "inventory"], ["number", 2]]
1054
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1055
+  (0.0ms) SAVEPOINT active_record_1
1056
+ DocumentNumber::DocumentNumber Load (0.1ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'inventory' LIMIT 1
1057
+ SQL (1.1ms) UPDATE "document_numbers" SET "number" = ? WHERE "document_numbers"."id" = 1 [["number", 3]]
1058
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1059
+  (0.1ms) SAVEPOINT active_record_1
1060
+ DocumentNumber::DocumentNumber Load (0.1ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'inventory' LIMIT 1
1061
+ SQL (0.1ms) UPDATE "document_numbers" SET "number" = ? WHERE "document_numbers"."id" = 1 [["number", 4]]
1062
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1063
+  (0.5ms) rollback transaction
1064
+  (0.1ms) begin transaction
1065
+  (0.0ms) SAVEPOINT active_record_1
1066
+  (0.0ms) SAVEPOINT active_record_2
1067
+ DocumentNumber::DocumentNumber Load (0.2ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'inventory' LIMIT 1
1068
+ SQL (0.2ms) INSERT INTO "document_numbers" ("created_at", "document", "number") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:42:34.049004"], ["document", "inventory"], ["number", 2]]
1069
+  (0.0ms) RELEASE SAVEPOINT active_record_2
1070
+ SQL (0.1ms) INSERT INTO "inventories" ("created_at", "number", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:42:34.047728"], ["number", "1"], ["updated_at", "2014-07-18 19:42:34.047728"]]
1071
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1072
+  (0.0ms) SAVEPOINT active_record_1
1073
+  (0.0ms) SAVEPOINT active_record_2
1074
+ DocumentNumber::DocumentNumber Load (0.1ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'inventory' LIMIT 1
1075
+ SQL (0.3ms) UPDATE "document_numbers" SET "number" = ? WHERE "document_numbers"."id" = 1 [["number", 3]]
1076
+  (0.0ms) RELEASE SAVEPOINT active_record_2
1077
+ SQL (0.1ms) INSERT INTO "inventories" ("created_at", "number", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:42:34.050883"], ["number", "2"], ["updated_at", "2014-07-18 19:42:34.050883"]]
1078
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1079
+  (0.7ms) rollback transaction
1080
+  (0.1ms) begin transaction
1081
+  (0.1ms) SAVEPOINT active_record_1
1082
+ SQL (0.4ms) INSERT INTO "inventories" ("created_at", "number", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:42:34.055956"], ["number", "500"], ["updated_at", "2014-07-18 19:42:34.055956"]]
1083
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1084
+  (0.4ms) rollback transaction
1085
+  (0.1ms) begin transaction
1086
+  (0.0ms) SAVEPOINT active_record_1
1087
+ SQL (0.3ms) INSERT INTO "inventories" ("created_at", "number", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:42:34.059505"], ["number", "5"], ["updated_at", "2014-07-18 19:42:34.059505"]]
1088
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1089
+  (0.0ms) SAVEPOINT active_record_1
1090
+ SQL (0.3ms) UPDATE "inventories" SET "updated_at" = '2014-07-18 19:42:34.060774' WHERE "inventories"."id" = 1
1091
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1092
+  (0.4ms) rollback transaction
1093
+  (0.1ms) begin transaction
1094
+  (0.0ms) SAVEPOINT active_record_1
1095
+ DocumentNumber::DocumentNumber Load (0.1ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'invoice' LIMIT 1
1096
+ SQL (0.2ms) INSERT INTO "document_numbers" ("created_at", "document", "number") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:42:34.064049"], ["document", "invoice"], ["number", 2]]
1097
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1098
+  (0.1ms) SAVEPOINT active_record_1
1099
+ DocumentNumber::DocumentNumber Load (0.1ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'invoice' LIMIT 1
1100
+ SQL (0.3ms) UPDATE "document_numbers" SET "number" = ? WHERE "document_numbers"."id" = 1 [["number", 3]]
1101
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1102
+  (0.0ms) SAVEPOINT active_record_1
1103
+ DocumentNumber::DocumentNumber Load (0.1ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'invoice' LIMIT 1
1104
+ SQL (0.1ms) UPDATE "document_numbers" SET "number" = ? WHERE "document_numbers"."id" = 1 [["number", 4]]
1105
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1106
+  (0.5ms) rollback transaction
1107
+  (0.1ms) begin transaction
1108
+  (0.0ms) SAVEPOINT active_record_1
1109
+  (0.1ms) SAVEPOINT active_record_2
1110
+ DocumentNumber::DocumentNumber Load (0.1ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'invoice' LIMIT 1
1111
+ SQL (0.3ms) INSERT INTO "document_numbers" ("created_at", "document", "number") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:42:34.074983"], ["document", "invoice"], ["number", 2]]
1112
+  (0.1ms) RELEASE SAVEPOINT active_record_2
1113
+ SQL (0.2ms) INSERT INTO "invoices" ("created_at", "number", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:42:34.070676"], ["number", "invoice/1"], ["updated_at", "2014-07-18 19:42:34.070676"]]
1114
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1115
+  (0.5ms) rollback transaction
1116
+  (0.1ms) begin transaction
1117
+  (0.0ms) SAVEPOINT active_record_1
1118
+  (0.1ms) SAVEPOINT active_record_2
1119
+ DocumentNumber::DocumentNumber Load (0.1ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'price_adjustment' LIMIT 1
1120
+ SQL (0.2ms) INSERT INTO "document_numbers" ("created_at", "document", "number") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:42:34.083640"], ["document", "price_adjustment"], ["number", 501]]
1121
+  (0.0ms) RELEASE SAVEPOINT active_record_2
1122
+ SQL (0.1ms) INSERT INTO "price_adjustments" ("created_at", "document_number", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:42:34.080073"], ["document_number", "500"], ["updated_at", "2014-07-18 19:42:34.080073"]]
1123
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1124
+  (0.5ms) rollback transaction
1125
+  (0.0ms) begin transaction
1126
+  (0.0ms) SAVEPOINT active_record_1
1127
+ DocumentNumber::DocumentNumber Load (0.2ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'price_adjustment' LIMIT 1
1128
+ SQL (0.3ms) INSERT INTO "document_numbers" ("created_at", "document", "number") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:42:34.087927"], ["document", "price_adjustment"], ["number", 501]]
1129
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1130
+  (0.0ms) SAVEPOINT active_record_1
1131
+ DocumentNumber::DocumentNumber Load (0.1ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'price_adjustment' LIMIT 1
1132
+ SQL (0.3ms) UPDATE "document_numbers" SET "number" = ? WHERE "document_numbers"."id" = 1 [["number", 502]]
1133
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1134
+  (0.0ms) SAVEPOINT active_record_1
1135
+ DocumentNumber::DocumentNumber Load (0.1ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'price_adjustment' LIMIT 1
1136
+ SQL (0.1ms) UPDATE "document_numbers" SET "number" = ? WHERE "document_numbers"."id" = 1 [["number", 503]]
1137
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1138
+  (0.4ms) rollback transaction
1139
+  (0.1ms) begin transaction
1140
+  (0.0ms) SAVEPOINT active_record_1
1141
+  (0.1ms) SAVEPOINT active_record_2
1142
+ DocumentNumber::DocumentNumber Load (0.1ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'price_adjustment' LIMIT 1
1143
+ SQL (0.2ms) INSERT INTO "document_numbers" ("created_at", "document", "number") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:42:34.094857"], ["document", "price_adjustment"], ["number", 501]]
1144
+  (0.1ms) RELEASE SAVEPOINT active_record_2
1145
+ SQL (0.1ms) INSERT INTO "price_adjustments" ("created_at", "document_number", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:42:34.093358"], ["document_number", "500"], ["updated_at", "2014-07-18 19:42:34.093358"]]
1146
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1147
+  (0.5ms) rollback transaction
1148
+  (0.1ms) begin transaction
1149
+  (0.0ms) SAVEPOINT active_record_1
1150
+  (0.0ms) SAVEPOINT active_record_2
1151
+ DocumentNumber::DocumentNumber Load (0.1ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'price_adjustment' LIMIT 1
1152
+ SQL (0.4ms) INSERT INTO "document_numbers" ("created_at", "document", "number") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:42:34.099175"], ["document", "price_adjustment"], ["number", 501]]
1153
+  (0.1ms) RELEASE SAVEPOINT active_record_2
1154
+ SQL (0.1ms) INSERT INTO "price_adjustments" ("created_at", "document_number", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:42:34.098017"], ["document_number", "500"], ["updated_at", "2014-07-18 19:42:34.098017"]]
1155
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1156
+  (0.0ms) SAVEPOINT active_record_1
1157
+  (0.0ms) SAVEPOINT active_record_2
1158
+ DocumentNumber::DocumentNumber Load (0.1ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'price_adjustment' LIMIT 1
1159
+ SQL (0.3ms) UPDATE "document_numbers" SET "number" = ? WHERE "document_numbers"."id" = 1 [["number", 502]]
1160
+  (0.0ms) RELEASE SAVEPOINT active_record_2
1161
+ SQL (0.1ms) INSERT INTO "price_adjustments" ("created_at", "document_number", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:42:34.101558"], ["document_number", "501"], ["updated_at", "2014-07-18 19:42:34.101558"]]
1162
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1163
+  (0.5ms) rollback transaction
1164
+  (1.9ms) CREATE TABLE "document_numbers" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "document" varchar(255), "number" integer DEFAULT 1 NOT NULL, "created_at" datetime) 
1165
+  (0.1ms) select sqlite_version(*)
1166
+  (0.8ms) CREATE UNIQUE INDEX "index_document_numbers_on_document" ON "document_numbers" ("document")
1167
+  (0.9ms) CREATE TABLE "inventories" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "number" varchar(255), "created_at" datetime, "updated_at" datetime)
1168
+  (0.8ms) CREATE TABLE "invoices" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "number" varchar(255), "created_at" datetime, "updated_at" datetime) 
1169
+  (0.9ms) CREATE TABLE "price_adjustments" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "document_number" varchar(255), "created_at" datetime, "updated_at" datetime)
1170
+  (1.1ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
1171
+  (1.0ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
1172
+  (0.1ms) SELECT version FROM "schema_migrations"
1173
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20140610093243')
1174
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20140610080445')
1175
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20140610090526')
1176
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20140610093227')
1177
+  (0.4ms) begin transaction
1178
+  (0.1ms) SAVEPOINT active_record_1
1179
+  (0.1ms) SAVEPOINT active_record_2
1180
+ DocumentNumber::DocumentNumber Load (0.1ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'price_adjustment' LIMIT 1
1181
+ SQL (0.4ms) INSERT INTO "document_numbers" ("created_at", "document", "number") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:44:46.499619"], ["document", "price_adjustment"], ["number", 501]]
1182
+  (0.1ms) RELEASE SAVEPOINT active_record_2
1183
+ SQL (0.1ms) INSERT INTO "price_adjustments" ("created_at", "document_number", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:44:46.477169"], ["document_number", "500"], ["updated_at", "2014-07-18 19:44:46.477169"]]
1184
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1185
+  (0.1ms) SAVEPOINT active_record_1
1186
+  (0.0ms) SAVEPOINT active_record_2
1187
+ DocumentNumber::DocumentNumber Load (0.1ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'price_adjustment' LIMIT 1
1188
+ SQL (1.0ms) UPDATE "document_numbers" SET "number" = ? WHERE "document_numbers"."id" = 1 [["number", 502]]
1189
+  (0.1ms) RELEASE SAVEPOINT active_record_2
1190
+ SQL (0.1ms) INSERT INTO "price_adjustments" ("created_at", "document_number", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:44:46.505583"], ["document_number", "501"], ["updated_at", "2014-07-18 19:44:46.505583"]]
1191
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1192
+  (0.5ms) rollback transaction
1193
+  (0.1ms) begin transaction
1194
+  (0.1ms) SAVEPOINT active_record_1
1195
+ DocumentNumber::DocumentNumber Load (0.1ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'price_adjustment' LIMIT 1
1196
+ SQL (0.2ms) INSERT INTO "document_numbers" ("created_at", "document", "number") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:44:46.512055"], ["document", "price_adjustment"], ["number", 501]]
1197
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1198
+  (0.1ms) SAVEPOINT active_record_1
1199
+ DocumentNumber::DocumentNumber Load (0.2ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'price_adjustment' LIMIT 1
1200
+ SQL (0.3ms) UPDATE "document_numbers" SET "number" = ? WHERE "document_numbers"."id" = 1 [["number", 502]]
1201
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1202
+  (0.0ms) SAVEPOINT active_record_1
1203
+ DocumentNumber::DocumentNumber Load (0.1ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'price_adjustment' LIMIT 1
1204
+ SQL (0.1ms) UPDATE "document_numbers" SET "number" = ? WHERE "document_numbers"."id" = 1 [["number", 503]]
1205
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1206
+  (0.5ms) rollback transaction
1207
+  (0.1ms) begin transaction
1208
+  (0.1ms) SAVEPOINT active_record_1
1209
+  (0.0ms) SAVEPOINT active_record_2
1210
+ DocumentNumber::DocumentNumber Load (0.1ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'price_adjustment' LIMIT 1
1211
+ SQL (0.2ms) INSERT INTO "document_numbers" ("created_at", "document", "number") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:44:46.519264"], ["document", "price_adjustment"], ["number", 501]]
1212
+  (0.0ms) RELEASE SAVEPOINT active_record_2
1213
+ SQL (0.1ms) INSERT INTO "price_adjustments" ("created_at", "document_number", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:44:46.518127"], ["document_number", "500"], ["updated_at", "2014-07-18 19:44:46.518127"]]
1214
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1215
+  (0.5ms) rollback transaction
1216
+  (0.1ms) begin transaction
1217
+  (0.0ms) SAVEPOINT active_record_1
1218
+  (0.0ms) SAVEPOINT active_record_2
1219
+ DocumentNumber::DocumentNumber Load (0.1ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'price_adjustment' LIMIT 1
1220
+ SQL (0.2ms) INSERT INTO "document_numbers" ("created_at", "document", "number") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:44:46.523470"], ["document", "price_adjustment"], ["number", 501]]
1221
+  (0.0ms) RELEASE SAVEPOINT active_record_2
1222
+ SQL (0.1ms) INSERT INTO "price_adjustments" ("created_at", "document_number", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:44:46.522302"], ["document_number", "500"], ["updated_at", "2014-07-18 19:44:46.522302"]]
1223
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1224
+  (0.4ms) rollback transaction
1225
+  (0.1ms) begin transaction
1226
+  (0.1ms) SAVEPOINT active_record_1
1227
+ DocumentNumber::DocumentNumber Load (0.1ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'invoice' LIMIT 1
1228
+ SQL (0.2ms) INSERT INTO "document_numbers" ("created_at", "document", "number") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:44:46.527790"], ["document", "invoice"], ["number", 2]]
1229
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1230
+  (0.0ms) SAVEPOINT active_record_1
1231
+ DocumentNumber::DocumentNumber Load (0.1ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'invoice' LIMIT 1
1232
+ SQL (0.3ms) UPDATE "document_numbers" SET "number" = ? WHERE "document_numbers"."id" = 1 [["number", 3]]
1233
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1234
+  (0.1ms) SAVEPOINT active_record_1
1235
+ DocumentNumber::DocumentNumber Load (0.1ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'invoice' LIMIT 1
1236
+ SQL (0.1ms) UPDATE "document_numbers" SET "number" = ? WHERE "document_numbers"."id" = 1 [["number", 4]]
1237
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1238
+  (0.4ms) rollback transaction
1239
+  (0.1ms) begin transaction
1240
+  (0.0ms) SAVEPOINT active_record_1
1241
+  (0.1ms) SAVEPOINT active_record_2
1242
+ DocumentNumber::DocumentNumber Load (0.1ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'invoice' LIMIT 1
1243
+ SQL (0.3ms) INSERT INTO "document_numbers" ("created_at", "document", "number") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:44:46.537847"], ["document", "invoice"], ["number", 2]]
1244
+  (0.0ms) RELEASE SAVEPOINT active_record_2
1245
+ SQL (0.1ms) INSERT INTO "invoices" ("created_at", "number", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:44:46.533997"], ["number", "invoice/1"], ["updated_at", "2014-07-18 19:44:46.533997"]]
1246
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1247
+  (0.5ms) rollback transaction
1248
+  (0.1ms) begin transaction
1249
+  (0.1ms) SAVEPOINT active_record_1
1250
+ SQL (0.3ms) INSERT INTO "inventories" ("created_at", "number", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:44:46.544672"], ["number", "500"], ["updated_at", "2014-07-18 19:44:46.544672"]]
1251
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1252
+  (0.3ms) rollback transaction
1253
+  (0.1ms) begin transaction
1254
+  (0.1ms) SAVEPOINT active_record_1
1255
+  (0.1ms) SAVEPOINT active_record_2
1256
+ DocumentNumber::DocumentNumber Load (0.2ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'inventory' LIMIT 1
1257
+ SQL (0.3ms) INSERT INTO "document_numbers" ("created_at", "document", "number") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:44:46.549187"], ["document", "inventory"], ["number", 2]]
1258
+  (0.1ms) RELEASE SAVEPOINT active_record_2
1259
+ SQL (0.1ms) INSERT INTO "inventories" ("created_at", "number", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:44:46.547553"], ["number", "1"], ["updated_at", "2014-07-18 19:44:46.547553"]]
1260
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1261
+  (0.0ms) SAVEPOINT active_record_1
1262
+  (0.0ms) SAVEPOINT active_record_2
1263
+ DocumentNumber::DocumentNumber Load (0.1ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'inventory' LIMIT 1
1264
+ SQL (0.3ms) UPDATE "document_numbers" SET "number" = ? WHERE "document_numbers"."id" = 1 [["number", 3]]
1265
+  (0.1ms) RELEASE SAVEPOINT active_record_2
1266
+ SQL (0.1ms) INSERT INTO "inventories" ("created_at", "number", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:44:46.551231"], ["number", "2"], ["updated_at", "2014-07-18 19:44:46.551231"]]
1267
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1268
+  (0.5ms) rollback transaction
1269
+  (0.0ms) begin transaction
1270
+  (0.0ms) rollback transaction
1271
+  (0.0ms) begin transaction
1272
+  (0.0ms) SAVEPOINT active_record_1
1273
+ SQL (0.2ms) INSERT INTO "inventories" ("created_at", "number", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:44:46.555759"], ["number", "5"], ["updated_at", "2014-07-18 19:44:46.555759"]]
1274
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1275
+  (0.0ms) SAVEPOINT active_record_1
1276
+ SQL (0.3ms) UPDATE "inventories" SET "updated_at" = '2014-07-18 19:44:46.556930' WHERE "inventories"."id" = 1
1277
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1278
+  (0.4ms) rollback transaction
1279
+  (0.1ms) begin transaction
1280
+  (0.1ms) SAVEPOINT active_record_1
1281
+ DocumentNumber::DocumentNumber Load (0.2ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'inventory' LIMIT 1
1282
+ SQL (0.3ms) INSERT INTO "document_numbers" ("created_at", "document", "number") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:44:46.561026"], ["document", "inventory"], ["number", 2]]
1283
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1284
+  (0.0ms) SAVEPOINT active_record_1
1285
+ DocumentNumber::DocumentNumber Load (0.1ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'inventory' LIMIT 1
1286
+ SQL (0.4ms) UPDATE "document_numbers" SET "number" = ? WHERE "document_numbers"."id" = 1 [["number", 3]]
1287
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1288
+  (0.0ms) SAVEPOINT active_record_1
1289
+ DocumentNumber::DocumentNumber Load (0.1ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'inventory' LIMIT 1
1290
+ SQL (0.1ms) UPDATE "document_numbers" SET "number" = ? WHERE "document_numbers"."id" = 1 [["number", 4]]
1291
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1292
+  (0.6ms) rollback transaction
1293
+  (0.1ms) begin transaction
1294
+  (0.0ms) SAVEPOINT active_record_1
1295
+ DocumentNumber::DocumentNumber Load (0.1ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'inventory' LIMIT 1
1296
+ SQL (0.2ms) INSERT INTO "document_numbers" ("created_at", "document", "number") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:44:46.568001"], ["document", "inventory"], ["number", 2]]
1297
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1298
+  (0.5ms) rollback transaction
1299
+  (0.1ms) begin transaction
1300
+  (0.0ms) SAVEPOINT active_record_1
1301
+  (0.0ms) SAVEPOINT active_record_2
1302
+ DocumentNumber::DocumentNumber Load (0.1ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'inventory' LIMIT 1
1303
+ SQL (0.2ms) INSERT INTO "document_numbers" ("created_at", "document", "number") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:44:46.571582"], ["document", "inventory"], ["number", 2]]
1304
+  (0.0ms) RELEASE SAVEPOINT active_record_2
1305
+ SQL (0.1ms) INSERT INTO "inventories" ("created_at", "number", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:44:46.570456"], ["number", "1"], ["updated_at", "2014-07-18 19:44:46.570456"]]
1306
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1307
+  (0.4ms) rollback transaction
1308
+  (2.8ms) CREATE TABLE "document_numbers" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "document" varchar(255), "number" integer DEFAULT 1 NOT NULL, "created_at" datetime) 
1309
+  (0.1ms) select sqlite_version(*)
1310
+  (1.1ms) CREATE UNIQUE INDEX "index_document_numbers_on_document" ON "document_numbers" ("document")
1311
+  (1.0ms) CREATE TABLE "inventories" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "number" varchar(255), "created_at" datetime, "updated_at" datetime)
1312
+  (0.9ms) CREATE TABLE "invoices" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "number" varchar(255), "created_at" datetime, "updated_at" datetime) 
1313
+  (0.9ms) CREATE TABLE "price_adjustments" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "document_number" varchar(255), "created_at" datetime, "updated_at" datetime)
1314
+  (0.9ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
1315
+  (1.0ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
1316
+  (0.1ms) SELECT version FROM "schema_migrations"
1317
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20140610093243')
1318
+  (0.7ms) INSERT INTO "schema_migrations" (version) VALUES ('20140610080445')
1319
+  (0.7ms) INSERT INTO "schema_migrations" (version) VALUES ('20140610090526')
1320
+  (0.7ms) INSERT INTO "schema_migrations" (version) VALUES ('20140610093227')
1321
+  (0.3ms) begin transaction
1322
+  (0.1ms) SAVEPOINT active_record_1
1323
+ SQL (0.4ms) INSERT INTO "inventories" ("created_at", "number", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:45:34.423829"], ["number", "5"], ["updated_at", "2014-07-18 19:45:34.423829"]]
1324
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1325
+  (0.0ms) SAVEPOINT active_record_1
1326
+ SQL (1.3ms) UPDATE "inventories" SET "updated_at" = '2014-07-18 19:45:34.427631' WHERE "inventories"."id" = 1
1327
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1328
+  (2.9ms) rollback transaction
1329
+  (0.2ms) begin transaction
1330
+  (0.1ms) SAVEPOINT active_record_1
1331
+  (0.1ms) SAVEPOINT active_record_2
1332
+ DocumentNumber::DocumentNumber Load (0.1ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'inventory' LIMIT 1
1333
+ SQL (0.5ms) INSERT INTO "document_numbers" ("created_at", "document", "number") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:45:34.448045"], ["document", "inventory"], ["number", 2]]
1334
+  (0.1ms) RELEASE SAVEPOINT active_record_2
1335
+ SQL (0.1ms) INSERT INTO "inventories" ("created_at", "number", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:45:34.439803"], ["number", "1"], ["updated_at", "2014-07-18 19:45:34.439803"]]
1336
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1337
+  (0.6ms) rollback transaction
1338
+  (0.1ms) begin transaction
1339
+  (0.0ms) SAVEPOINT active_record_1
1340
+ DocumentNumber::DocumentNumber Load (0.1ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'inventory' LIMIT 1
1341
+ SQL (0.2ms) INSERT INTO "document_numbers" ("created_at", "document", "number") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:45:34.452989"], ["document", "inventory"], ["number", 2]]
1342
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1343
+  (0.4ms) rollback transaction
1344
+  (0.1ms) begin transaction
1345
+  (0.1ms) SAVEPOINT active_record_1
1346
+ SQL (0.4ms) INSERT INTO "inventories" ("created_at", "number", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:45:34.456321"], ["number", "500"], ["updated_at", "2014-07-18 19:45:34.456321"]]
1347
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1348
+  (0.5ms) rollback transaction
1349
+  (0.1ms) begin transaction
1350
+  (0.1ms) SAVEPOINT active_record_1
1351
+ DocumentNumber::DocumentNumber Load (0.2ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'inventory' LIMIT 1
1352
+ SQL (0.2ms) INSERT INTO "document_numbers" ("created_at", "document", "number") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:45:34.460925"], ["document", "inventory"], ["number", 2]]
1353
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1354
+  (0.0ms) SAVEPOINT active_record_1
1355
+ DocumentNumber::DocumentNumber Load (0.1ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'inventory' LIMIT 1
1356
+ SQL (0.4ms) UPDATE "document_numbers" SET "number" = ? WHERE "document_numbers"."id" = 1 [["number", 3]]
1357
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1358
+  (0.0ms) SAVEPOINT active_record_1
1359
+ DocumentNumber::DocumentNumber Load (0.1ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'inventory' LIMIT 1
1360
+ SQL (0.1ms) UPDATE "document_numbers" SET "number" = ? WHERE "document_numbers"."id" = 1 [["number", 4]]
1361
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1362
+  (0.5ms) rollback transaction
1363
+  (0.1ms) begin transaction
1364
+  (0.1ms) SAVEPOINT active_record_1
1365
+  (0.1ms) SAVEPOINT active_record_2
1366
+ DocumentNumber::DocumentNumber Load (0.2ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'inventory' LIMIT 1
1367
+ SQL (0.2ms) INSERT INTO "document_numbers" ("created_at", "document", "number") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:45:34.470313"], ["document", "inventory"], ["number", 2]]
1368
+  (0.1ms) RELEASE SAVEPOINT active_record_2
1369
+ SQL (0.2ms) INSERT INTO "inventories" ("created_at", "number", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:45:34.468149"], ["number", "1"], ["updated_at", "2014-07-18 19:45:34.468149"]]
1370
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1371
+  (0.1ms) SAVEPOINT active_record_1
1372
+  (0.0ms) SAVEPOINT active_record_2
1373
+ DocumentNumber::DocumentNumber Load (0.1ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'inventory' LIMIT 1
1374
+ SQL (0.3ms) UPDATE "document_numbers" SET "number" = ? WHERE "document_numbers"."id" = 1 [["number", 3]]
1375
+  (0.0ms) RELEASE SAVEPOINT active_record_2
1376
+ SQL (0.1ms) INSERT INTO "inventories" ("created_at", "number", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:45:34.473525"], ["number", "2"], ["updated_at", "2014-07-18 19:45:34.473525"]]
1377
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1378
+  (0.5ms) rollback transaction
1379
+  (0.1ms) begin transaction
1380
+  (0.0ms) rollback transaction
1381
+  (0.0ms) begin transaction
1382
+  (0.0ms) SAVEPOINT active_record_1
1383
+  (0.1ms) SAVEPOINT active_record_2
1384
+ DocumentNumber::DocumentNumber Load (0.1ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'invoice' LIMIT 1
1385
+ SQL (0.2ms) INSERT INTO "document_numbers" ("created_at", "document", "number") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:45:34.483148"], ["document", "invoice"], ["number", 2]]
1386
+  (0.1ms) RELEASE SAVEPOINT active_record_2
1387
+ SQL (0.1ms) INSERT INTO "invoices" ("created_at", "number", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:45:34.479814"], ["number", "invoice/1"], ["updated_at", "2014-07-18 19:45:34.479814"]]
1388
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1389
+  (0.6ms) rollback transaction
1390
+  (0.1ms) begin transaction
1391
+  (0.0ms) SAVEPOINT active_record_1
1392
+ DocumentNumber::DocumentNumber Load (0.1ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'invoice' LIMIT 1
1393
+ SQL (0.2ms) INSERT INTO "document_numbers" ("created_at", "document", "number") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:45:34.487373"], ["document", "invoice"], ["number", 2]]
1394
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1395
+  (0.0ms) SAVEPOINT active_record_1
1396
+ DocumentNumber::DocumentNumber Load (0.1ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'invoice' LIMIT 1
1397
+ SQL (0.3ms) UPDATE "document_numbers" SET "number" = ? WHERE "document_numbers"."id" = 1 [["number", 3]]
1398
+  (0.3ms) RELEASE SAVEPOINT active_record_1
1399
+  (0.1ms) SAVEPOINT active_record_1
1400
+ DocumentNumber::DocumentNumber Load (0.1ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'invoice' LIMIT 1
1401
+ SQL (0.1ms) UPDATE "document_numbers" SET "number" = ? WHERE "document_numbers"."id" = 1 [["number", 4]]
1402
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1403
+  (0.5ms) rollback transaction
1404
+  (0.1ms) begin transaction
1405
+  (0.1ms) SAVEPOINT active_record_1
1406
+ DocumentNumber::DocumentNumber Load (0.2ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'invoice' LIMIT 1
1407
+ SQL (0.3ms) INSERT INTO "document_numbers" ("created_at", "document", "number") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:45:34.495363"], ["document", "invoice"], ["number", 2]]
1408
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1409
+  (0.5ms) rollback transaction
1410
+  (0.1ms) begin transaction
1411
+  (0.1ms) rollback transaction
1412
+  (0.0ms) begin transaction
1413
+  (0.0ms) SAVEPOINT active_record_1
1414
+  (0.1ms) SAVEPOINT active_record_2
1415
+ DocumentNumber::DocumentNumber Load (0.1ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'price_adjustment' LIMIT 1
1416
+ SQL (0.3ms) INSERT INTO "document_numbers" ("created_at", "document", "number") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:45:34.504589"], ["document", "price_adjustment"], ["number", 501]]
1417
+  (0.1ms) RELEASE SAVEPOINT active_record_2
1418
+ SQL (0.2ms) INSERT INTO "price_adjustments" ("created_at", "document_number", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:45:34.500535"], ["document_number", "500"], ["updated_at", "2014-07-18 19:45:34.500535"]]
1419
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1420
+  (0.0ms) SAVEPOINT active_record_1
1421
+  (0.1ms) SAVEPOINT active_record_2
1422
+ DocumentNumber::DocumentNumber Load (0.1ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'price_adjustment' LIMIT 1
1423
+ SQL (0.4ms) UPDATE "document_numbers" SET "number" = ? WHERE "document_numbers"."id" = 1 [["number", 502]]
1424
+  (0.1ms) RELEASE SAVEPOINT active_record_2
1425
+ SQL (0.1ms) INSERT INTO "price_adjustments" ("created_at", "document_number", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:45:34.507315"], ["document_number", "501"], ["updated_at", "2014-07-18 19:45:34.507315"]]
1426
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1427
+  (0.5ms) rollback transaction
1428
+  (0.1ms) begin transaction
1429
+  (0.0ms) SAVEPOINT active_record_1
1430
+  (0.0ms) SAVEPOINT active_record_2
1431
+ DocumentNumber::DocumentNumber Load (0.1ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'price_adjustment' LIMIT 1
1432
+ SQL (0.2ms) INSERT INTO "document_numbers" ("created_at", "document", "number") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:45:34.513320"], ["document", "price_adjustment"], ["number", 501]]
1433
+  (0.0ms) RELEASE SAVEPOINT active_record_2
1434
+ SQL (0.1ms) INSERT INTO "price_adjustments" ("created_at", "document_number", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:45:34.512110"], ["document_number", "500"], ["updated_at", "2014-07-18 19:45:34.512110"]]
1435
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1436
+  (0.5ms) rollback transaction
1437
+  (0.1ms) begin transaction
1438
+  (0.0ms) rollback transaction
1439
+  (0.1ms) begin transaction
1440
+  (0.0ms) SAVEPOINT active_record_1
1441
+  (0.1ms) SAVEPOINT active_record_2
1442
+ DocumentNumber::DocumentNumber Load (0.2ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'price_adjustment' LIMIT 1
1443
+ SQL (0.2ms) INSERT INTO "document_numbers" ("created_at", "document", "number") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:45:34.518609"], ["document", "price_adjustment"], ["number", 501]]
1444
+  (0.1ms) RELEASE SAVEPOINT active_record_2
1445
+ SQL (0.1ms) INSERT INTO "price_adjustments" ("created_at", "document_number", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:45:34.517375"], ["document_number", "500"], ["updated_at", "2014-07-18 19:45:34.517375"]]
1446
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1447
+  (0.5ms) rollback transaction
1448
+  (0.1ms) begin transaction
1449
+  (0.0ms) SAVEPOINT active_record_1
1450
+ DocumentNumber::DocumentNumber Load (0.2ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'price_adjustment' LIMIT 1
1451
+ SQL (0.4ms) INSERT INTO "document_numbers" ("created_at", "document", "number") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:45:34.523449"], ["document", "price_adjustment"], ["number", 501]]
1452
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1453
+  (0.5ms) rollback transaction
1454
+  (0.1ms) begin transaction
1455
+  (0.1ms) SAVEPOINT active_record_1
1456
+ DocumentNumber::DocumentNumber Load (0.3ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'price_adjustment' LIMIT 1
1457
+ SQL (0.2ms) INSERT INTO "document_numbers" ("created_at", "document", "number") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:45:34.528601"], ["document", "price_adjustment"], ["number", 501]]
1458
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1459
+  (0.0ms) SAVEPOINT active_record_1
1460
+ DocumentNumber::DocumentNumber Load (0.1ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'price_adjustment' LIMIT 1
1461
+ SQL (0.3ms) UPDATE "document_numbers" SET "number" = ? WHERE "document_numbers"."id" = 1 [["number", 502]]
1462
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1463
+  (0.0ms) SAVEPOINT active_record_1
1464
+ DocumentNumber::DocumentNumber Load (0.1ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'price_adjustment' LIMIT 1
1465
+ SQL (0.1ms) UPDATE "document_numbers" SET "number" = ? WHERE "document_numbers"."id" = 1 [["number", 503]]
1466
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1467
+  (0.5ms) rollback transaction
1468
+  (105.9ms) CREATE TABLE "document_numbers" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "document" varchar(255), "number" integer DEFAULT 1 NOT NULL, "created_at" datetime) 
1469
+  (0.2ms) select sqlite_version(*)
1470
+  (3.0ms) CREATE UNIQUE INDEX "index_document_numbers_on_document" ON "document_numbers" ("document")
1471
+  (1.3ms) CREATE TABLE "inventories" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "number" varchar(255), "created_at" datetime, "updated_at" datetime)
1472
+  (0.9ms) CREATE TABLE "invoices" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "number" varchar(255), "created_at" datetime, "updated_at" datetime) 
1473
+  (1.0ms) CREATE TABLE "price_adjustments" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "document_number" varchar(255), "created_at" datetime, "updated_at" datetime)
1474
+  (1.1ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
1475
+  (0.9ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
1476
+  (0.1ms) SELECT version FROM "schema_migrations"
1477
+  (0.9ms) INSERT INTO "schema_migrations" (version) VALUES ('20140610093243')
1478
+  (0.7ms) INSERT INTO "schema_migrations" (version) VALUES ('20140610080445')
1479
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20140610090526')
1480
+  (0.9ms) INSERT INTO "schema_migrations" (version) VALUES ('20140610093227')
1481
+  (0.3ms) begin transaction
1482
+  (0.0ms) SAVEPOINT active_record_1
1483
+ DocumentNumber::DocumentNumber Load (0.1ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'invoice' LIMIT 1
1484
+ SQL (0.4ms) INSERT INTO "document_numbers" ("created_at", "document", "number") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:45:49.581513"], ["document", "invoice"], ["number", 2]]
1485
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1486
+  (0.0ms) SAVEPOINT active_record_1
1487
+ DocumentNumber::DocumentNumber Load (0.1ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'invoice' LIMIT 1
1488
+ SQL (1.3ms) UPDATE "document_numbers" SET "number" = ? WHERE "document_numbers"."id" = 1 [["number", 3]]
1489
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1490
+  (0.1ms) SAVEPOINT active_record_1
1491
+ DocumentNumber::DocumentNumber Load (0.1ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'invoice' LIMIT 1
1492
+ SQL (0.1ms) UPDATE "document_numbers" SET "number" = ? WHERE "document_numbers"."id" = 1 [["number", 4]]
1493
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1494
+  (2.7ms) rollback transaction
1495
+  (0.1ms) begin transaction
1496
+  (0.1ms) rollback transaction
1497
+  (0.1ms) begin transaction
1498
+  (0.0ms) SAVEPOINT active_record_1
1499
+ DocumentNumber::DocumentNumber Load (0.1ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'invoice' LIMIT 1
1500
+ SQL (0.2ms) INSERT INTO "document_numbers" ("created_at", "document", "number") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:45:49.601759"], ["document", "invoice"], ["number", 2]]
1501
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1502
+  (0.4ms) rollback transaction
1503
+  (0.1ms) begin transaction
1504
+  (0.0ms) SAVEPOINT active_record_1
1505
+  (0.0ms) SAVEPOINT active_record_2
1506
+ DocumentNumber::DocumentNumber Load (0.1ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'invoice' LIMIT 1
1507
+ SQL (0.3ms) INSERT INTO "document_numbers" ("created_at", "document", "number") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:45:49.605645"], ["document", "invoice"], ["number", 2]]
1508
+  (0.1ms) RELEASE SAVEPOINT active_record_2
1509
+ SQL (0.2ms) INSERT INTO "invoices" ("created_at", "number", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:45:49.604336"], ["number", "invoice/1"], ["updated_at", "2014-07-18 19:45:49.604336"]]
1510
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1511
+  (0.5ms) rollback transaction
1512
+  (0.1ms) begin transaction
1513
+  (0.1ms) rollback transaction
1514
+  (0.1ms) begin transaction
1515
+  (0.0ms) SAVEPOINT active_record_1
1516
+ DocumentNumber::DocumentNumber Load (0.1ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'price_adjustment' LIMIT 1
1517
+ SQL (0.2ms) INSERT INTO "document_numbers" ("created_at", "document", "number") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:45:49.615540"], ["document", "price_adjustment"], ["number", 501]]
1518
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1519
+  (0.0ms) SAVEPOINT active_record_1
1520
+ DocumentNumber::DocumentNumber Load (0.1ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'price_adjustment' LIMIT 1
1521
+ SQL (0.3ms) UPDATE "document_numbers" SET "number" = ? WHERE "document_numbers"."id" = 1 [["number", 502]]
1522
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1523
+  (0.0ms) SAVEPOINT active_record_1
1524
+ DocumentNumber::DocumentNumber Load (0.1ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'price_adjustment' LIMIT 1
1525
+ SQL (0.1ms) UPDATE "document_numbers" SET "number" = ? WHERE "document_numbers"."id" = 1 [["number", 503]]
1526
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1527
+  (0.8ms) rollback transaction
1528
+  (0.1ms) begin transaction
1529
+  (0.1ms) SAVEPOINT active_record_1
1530
+  (0.1ms) SAVEPOINT active_record_2
1531
+ DocumentNumber::DocumentNumber Load (0.2ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'price_adjustment' LIMIT 1
1532
+ SQL (0.2ms) INSERT INTO "document_numbers" ("created_at", "document", "number") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:45:49.624197"], ["document", "price_adjustment"], ["number", 501]]
1533
+  (0.0ms) RELEASE SAVEPOINT active_record_2
1534
+ SQL (0.2ms) INSERT INTO "price_adjustments" ("created_at", "document_number", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:45:49.622172"], ["document_number", "500"], ["updated_at", "2014-07-18 19:45:49.622172"]]
1535
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1536
+  (0.5ms) rollback transaction
1537
+  (0.1ms) begin transaction
1538
+  (0.1ms) SAVEPOINT active_record_1
1539
+ DocumentNumber::DocumentNumber Load (0.1ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'price_adjustment' LIMIT 1
1540
+ SQL (0.3ms) INSERT INTO "document_numbers" ("created_at", "document", "number") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:45:49.628892"], ["document", "price_adjustment"], ["number", 501]]
1541
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1542
+  (0.5ms) rollback transaction
1543
+  (0.1ms) begin transaction
1544
+  (0.0ms) SAVEPOINT active_record_1
1545
+  (0.0ms) SAVEPOINT active_record_2
1546
+ DocumentNumber::DocumentNumber Load (0.1ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'price_adjustment' LIMIT 1
1547
+ SQL (0.2ms) INSERT INTO "document_numbers" ("created_at", "document", "number") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:45:49.632920"], ["document", "price_adjustment"], ["number", 501]]
1548
+  (0.0ms) RELEASE SAVEPOINT active_record_2
1549
+ SQL (0.1ms) INSERT INTO "price_adjustments" ("created_at", "document_number", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:45:49.631790"], ["document_number", "500"], ["updated_at", "2014-07-18 19:45:49.631790"]]
1550
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1551
+  (0.1ms) SAVEPOINT active_record_1
1552
+  (0.1ms) SAVEPOINT active_record_2
1553
+ DocumentNumber::DocumentNumber Load (0.1ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'price_adjustment' LIMIT 1
1554
+ SQL (0.3ms) UPDATE "document_numbers" SET "number" = ? WHERE "document_numbers"."id" = 1 [["number", 502]]
1555
+  (0.0ms) RELEASE SAVEPOINT active_record_2
1556
+ SQL (0.1ms) INSERT INTO "price_adjustments" ("created_at", "document_number", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:45:49.634735"], ["document_number", "501"], ["updated_at", "2014-07-18 19:45:49.634735"]]
1557
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1558
+  (0.5ms) rollback transaction
1559
+  (0.1ms) begin transaction
1560
+  (0.0ms) SAVEPOINT active_record_1
1561
+  (0.0ms) SAVEPOINT active_record_2
1562
+ DocumentNumber::DocumentNumber Load (0.1ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'price_adjustment' LIMIT 1
1563
+ SQL (0.2ms) INSERT INTO "document_numbers" ("created_at", "document", "number") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:45:49.639880"], ["document", "price_adjustment"], ["number", 501]]
1564
+  (0.0ms) RELEASE SAVEPOINT active_record_2
1565
+ SQL (0.1ms) INSERT INTO "price_adjustments" ("created_at", "document_number", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:45:49.638690"], ["document_number", "500"], ["updated_at", "2014-07-18 19:45:49.638690"]]
1566
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1567
+  (0.5ms) rollback transaction
1568
+  (0.1ms) begin transaction
1569
+  (0.0ms) SAVEPOINT active_record_1
1570
+  (0.1ms) SAVEPOINT active_record_2
1571
+ DocumentNumber::DocumentNumber Load (0.1ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'inventory' LIMIT 1
1572
+ SQL (0.3ms) INSERT INTO "document_numbers" ("created_at", "document", "number") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:45:49.648121"], ["document", "inventory"], ["number", 2]]
1573
+  (0.1ms) RELEASE SAVEPOINT active_record_2
1574
+ SQL (0.1ms) INSERT INTO "inventories" ("created_at", "number", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:45:49.644296"], ["number", "1"], ["updated_at", "2014-07-18 19:45:49.644296"]]
1575
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1576
+  (0.0ms) SAVEPOINT active_record_1
1577
+  (0.0ms) SAVEPOINT active_record_2
1578
+ DocumentNumber::DocumentNumber Load (0.1ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'inventory' LIMIT 1
1579
+ SQL (0.3ms) UPDATE "document_numbers" SET "number" = ? WHERE "document_numbers"."id" = 1 [["number", 3]]
1580
+  (0.0ms) RELEASE SAVEPOINT active_record_2
1581
+ SQL (0.1ms) INSERT INTO "inventories" ("created_at", "number", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:45:49.650547"], ["number", "2"], ["updated_at", "2014-07-18 19:45:49.650547"]]
1582
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1583
+  (0.5ms) rollback transaction
1584
+  (0.1ms) begin transaction
1585
+  (0.0ms) rollback transaction
1586
+  (0.1ms) begin transaction
1587
+  (0.0ms) SAVEPOINT active_record_1
1588
+ DocumentNumber::DocumentNumber Load (0.1ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'inventory' LIMIT 1
1589
+ SQL (0.3ms) INSERT INTO "document_numbers" ("created_at", "document", "number") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:45:49.655994"], ["document", "inventory"], ["number", 2]]
1590
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1591
+  (0.0ms) SAVEPOINT active_record_1
1592
+ DocumentNumber::DocumentNumber Load (0.1ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'inventory' LIMIT 1
1593
+ SQL (0.3ms) UPDATE "document_numbers" SET "number" = ? WHERE "document_numbers"."id" = 1 [["number", 3]]
1594
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1595
+  (0.0ms) SAVEPOINT active_record_1
1596
+ DocumentNumber::DocumentNumber Load (0.1ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'inventory' LIMIT 1
1597
+ SQL (0.1ms) UPDATE "document_numbers" SET "number" = ? WHERE "document_numbers"."id" = 1 [["number", 4]]
1598
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1599
+  (0.5ms) rollback transaction
1600
+  (0.1ms) begin transaction
1601
+  (0.0ms) SAVEPOINT active_record_1
1602
+ SQL (0.3ms) INSERT INTO "inventories" ("created_at", "number", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:45:49.661520"], ["number", "500"], ["updated_at", "2014-07-18 19:45:49.661520"]]
1603
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1604
+  (0.5ms) rollback transaction
1605
+  (0.1ms) begin transaction
1606
+  (0.0ms) SAVEPOINT active_record_1
1607
+ DocumentNumber::DocumentNumber Load (0.1ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'inventory' LIMIT 1
1608
+ SQL (0.2ms) INSERT INTO "document_numbers" ("created_at", "document", "number") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:45:49.664993"], ["document", "inventory"], ["number", 2]]
1609
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1610
+  (0.5ms) rollback transaction
1611
+  (0.1ms) begin transaction
1612
+  (0.0ms) SAVEPOINT active_record_1
1613
+ SQL (0.2ms) INSERT INTO "inventories" ("created_at", "number", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:45:49.667548"], ["number", "5"], ["updated_at", "2014-07-18 19:45:49.667548"]]
1614
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1615
+  (0.0ms) SAVEPOINT active_record_1
1616
+ SQL (0.3ms) UPDATE "inventories" SET "updated_at" = '2014-07-18 19:45:49.668814' WHERE "inventories"."id" = 1
1617
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1618
+  (0.4ms) rollback transaction
1619
+  (0.1ms) begin transaction
1620
+  (0.1ms) SAVEPOINT active_record_1
1621
+  (0.0ms) SAVEPOINT active_record_2
1622
+ DocumentNumber::DocumentNumber Load (0.2ms) SELECT "document_numbers".* FROM "document_numbers" WHERE "document_numbers"."document" = 'inventory' LIMIT 1
1623
+ SQL (0.2ms) INSERT INTO "document_numbers" ("created_at", "document", "number") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:45:49.672963"], ["document", "inventory"], ["number", 2]]
1624
+  (0.0ms) RELEASE SAVEPOINT active_record_2
1625
+ SQL (0.1ms) INSERT INTO "inventories" ("created_at", "number", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-07-18 19:45:49.671615"], ["number", "1"], ["updated_at", "2014-07-18 19:45:49.671615"]]
1626
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1627
+  (0.4ms) rollback transaction
@@ -21,4 +21,16 @@ describe Inventory do
21
21
  expect(Inventory.create.number).to eq('1')
22
22
  expect(Inventory.create.number).to eq('2')
23
23
  end
24
+
25
+ it 'gets array of numbers' do
26
+ expect(Inventory.get_numbers(3)).to eq(%w(1 2 3))
27
+ end
28
+
29
+ it 'assigns number after initialization if has with_number' do
30
+ expect(Inventory.new(with_number: true).number).to eq('1')
31
+ end
32
+
33
+ it 'does not assign number after initialization' do
34
+ expect(Inventory.new.number).to be_nil
35
+ end
24
36
  end
@@ -5,4 +5,16 @@ describe Invoice do
5
5
  invoice = Invoice.create
6
6
  expect(invoice.number).to eq('invoice/1')
7
7
  end
8
+
9
+ it 'gets array of numbers with prefix' do
10
+ expect(Invoice.get_numbers(3)).to eq(%w(invoice/1 invoice/2 invoice/3))
11
+ end
12
+
13
+ it 'assigns number after initialization if has with_number' do
14
+ expect(Invoice.new(with_number: true).number).to eq('invoice/1')
15
+ end
16
+
17
+ it 'does not assign number after initialization' do
18
+ expect(Invoice.new.number).to be_nil
19
+ end
8
20
  end
@@ -15,4 +15,16 @@ describe PriceAdjustment do
15
15
  expect(PriceAdjustment.create.document_number).to eq('500')
16
16
  expect(PriceAdjustment.create.document_number).to eq('501')
17
17
  end
18
+
19
+ it 'gets array of numbers' do
20
+ expect(PriceAdjustment.get_numbers(3)).to eq(%w(500 501 502))
21
+ end
22
+
23
+ it 'assigns number after initialization if has with_number' do
24
+ expect(PriceAdjustment.new(with_number: true).document_number).to eq('500')
25
+ end
26
+
27
+ it 'does not assign number after initialization' do
28
+ expect(PriceAdjustment.new.document_number).to be_nil
29
+ end
18
30
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: document_number
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.4
4
+ version: 0.9.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Evgeny Pavlov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-08 00:00:00.000000000 Z
11
+ date: 2014-07-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -242,7 +242,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
242
242
  version: '0'
243
243
  requirements: []
244
244
  rubyforge_project:
245
- rubygems_version: 2.2.2
245
+ rubygems_version: 2.4.0
246
246
  signing_key:
247
247
  specification_version: 4
248
248
  summary: Automatic document number assignment