acts_as_ruintsti 0.0.1 → 0.0.2

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: 6b809208088680bef96674626b3d84d4aa643e83
4
- data.tar.gz: 0a02f1e0033a7a9e32ac11a13f060fbfb51c90b1
3
+ metadata.gz: 55bb3314bf2df45e9499ba3e5eeee0b1f9284f24
4
+ data.tar.gz: d7e538b5a7645963bf35e272b1333c44d548bd7f
5
5
  SHA512:
6
- metadata.gz: b2e130f9997766a9e9bd5601c1324772393713af6f892335114f5c26e500a6b0f74df534e639b989d35e6f01abfccf0bba3e60a6408795790964a31c802175ca
7
- data.tar.gz: 195e85f156a34f9b3fb566a9701d47ea083992c20fa1bb28e1e4fd0394e15279359d2e471dcfdd023830eeb25bca3d47a11224c0a0ccc0ba86c32c854b318d47
6
+ metadata.gz: 758ae15f828db1c2404fa2b4da586e64e77f965f17063dbb9d2069610c8ad46d989e16a26a28d44c2ba5a507e1b0eaaa2f62dcdfb4e1529bbc329a947d01119e
7
+ data.tar.gz: 8b454285c0bb588cdef465d9b75ee164ee268d4adcc513782475da16bc4529453462ba78f79f965f6005f75b74c6c000c655a528d002004d2a6f381c8f5c11ba
@@ -20,6 +20,21 @@ module ActsAsRuintsti
20
20
  class_name = @@acts_as_ruintsti_params[type_name.to_i]
21
21
  class_name ? class_name.constantize : self
22
22
  end
23
+ def subclass_from_attrs(attr)
24
+ type_num = attr.with_indifferent_access[inheritance_column]
25
+ if type_num.present?
26
+ subclass_name = @@acts_as_ruintsti_params[type_num]
27
+ if subclass_name.present? && subclass_name != self.name
28
+ subclass = subclass_name.safe_constantize
29
+ unless descendants.include?(subclass)
30
+ raise ActiveRecord::SubclassNotFound.new("Invalid single-table inheritance type: #{subclass_name} is not a subclass of #{name}")
31
+ end
32
+ subclass
33
+ elsif subclass_name.blank?
34
+ raise ActiveRecord::SubclassNotFound.new("Invalid single-table inheritance type number: #{type_num} is not a subclass of #{name}")
35
+ end
36
+ end
37
+ end
23
38
  end
24
39
  end
25
40
 
@@ -1,3 +1,3 @@
1
1
  module ActsAsRuintsti
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -42,4 +42,18 @@ class ActsAsRuintstiTest < ActiveSupport::TestCase
42
42
  test "loaded BlueBlock's class is BlueBlock" do
43
43
  assert_equal Block.find(@blue.id).class, BlueBlock
44
44
  end
45
+
46
+ test "when create block type=1, created RedBlock" do
47
+ assert_equal Block.new(:type => 1).class, RedBlock
48
+ end
49
+
50
+ test "when create block type=2, created BlueBlock" do
51
+ assert_equal Block.new(:type => 2).class, BlueBlock
52
+ end
53
+
54
+ test "when create block type=3, raise SubclassNotFound" do
55
+ assert_raise ActiveRecord::SubclassNotFound do
56
+ Block.new(:type => 3)
57
+ end
58
+ end
45
59
  end
@@ -819,3 +819,482 @@ ActsAsRuintstiTest: test_loaded_RedBlock's_class_is_RedBlock
819
819
  SQL (0.1ms) DELETE FROM "blocks" WHERE "blocks"."type" IN (1) AND "blocks"."id" = 1
820
820
  SQL (0.1ms) DELETE FROM "blocks" WHERE "blocks"."type" IN (2) AND "blocks"."id" = 2
821
821
   (0.6ms) rollback transaction
822
+  (0.3ms) begin transaction
823
+ ----------------------------------------------
824
+ ActsAsRuintstiTest: test_BlueBlock's_type_is_2
825
+ ----------------------------------------------
826
+  (0.0ms) SAVEPOINT active_record_1
827
+ SQL (4.8ms) INSERT INTO "blocks" ("type") VALUES (?) [["type", 1]]
828
+  (0.1ms) RELEASE SAVEPOINT active_record_1
829
+  (0.0ms) SAVEPOINT active_record_1
830
+ SQL (0.3ms) INSERT INTO "blocks" ("type") VALUES (?) [["type", 2]]
831
+  (0.1ms) RELEASE SAVEPOINT active_record_1
832
+ Block Load (0.1ms) SELECT "blocks".* FROM "blocks" WHERE "blocks"."id" = ? LIMIT 1 [["id", 2]]
833
+ SQL (0.2ms) DELETE FROM "blocks" WHERE "blocks"."type" IN (1) AND "blocks"."id" = 1
834
+ SQL (0.1ms) DELETE FROM "blocks" WHERE "blocks"."type" IN (2) AND "blocks"."id" = 2
835
+  (1.0ms) rollback transaction
836
+  (0.1ms) begin transaction
837
+ ---------------------------------------------
838
+ ActsAsRuintstiTest: test_RedBlock's_type_is_1
839
+ ---------------------------------------------
840
+  (0.1ms) SAVEPOINT active_record_1
841
+ SQL (0.3ms) INSERT INTO "blocks" ("type") VALUES (?) [["type", 1]]
842
+  (0.0ms) RELEASE SAVEPOINT active_record_1
843
+  (0.1ms) SAVEPOINT active_record_1
844
+ SQL (0.3ms) INSERT INTO "blocks" ("type") VALUES (?) [["type", 2]]
845
+  (0.1ms) RELEASE SAVEPOINT active_record_1
846
+ Block Load (0.1ms) SELECT "blocks".* FROM "blocks" WHERE "blocks"."id" = ? LIMIT 1 [["id", 1]]
847
+ SQL (0.1ms) DELETE FROM "blocks" WHERE "blocks"."type" IN (1) AND "blocks"."id" = 1
848
+ SQL (0.1ms) DELETE FROM "blocks" WHERE "blocks"."type" IN (2) AND "blocks"."id" = 2
849
+  (0.7ms) rollback transaction
850
+  (0.0ms) begin transaction
851
+ --------------------------------------------------------------
852
+ ActsAsRuintstiTest: test_loaded_BlueBlock's_class_is_BlueBlock
853
+ --------------------------------------------------------------
854
+  (0.0ms) SAVEPOINT active_record_1
855
+ SQL (0.2ms) INSERT INTO "blocks" ("type") VALUES (?) [["type", 1]]
856
+  (0.0ms) RELEASE SAVEPOINT active_record_1
857
+  (0.0ms) SAVEPOINT active_record_1
858
+ SQL (0.2ms) INSERT INTO "blocks" ("type") VALUES (?) [["type", 2]]
859
+  (0.0ms) RELEASE SAVEPOINT active_record_1
860
+ Block Load (0.0ms) SELECT "blocks".* FROM "blocks" WHERE "blocks"."id" = ? LIMIT 1 [["id", 2]]
861
+ SQL (0.1ms) DELETE FROM "blocks" WHERE "blocks"."type" IN (1) AND "blocks"."id" = 1
862
+ SQL (0.1ms) DELETE FROM "blocks" WHERE "blocks"."type" IN (2) AND "blocks"."id" = 2
863
+  (0.7ms) rollback transaction
864
+  (0.1ms) begin transaction
865
+ ------------------------------------------------------------
866
+ ActsAsRuintstiTest: test_loaded_RedBlock's_class_is_RedBlock
867
+ ------------------------------------------------------------
868
+  (0.1ms) SAVEPOINT active_record_1
869
+ SQL (0.3ms) INSERT INTO "blocks" ("type") VALUES (?) [["type", 1]]
870
+  (0.1ms) RELEASE SAVEPOINT active_record_1
871
+  (0.0ms) SAVEPOINT active_record_1
872
+ SQL (0.3ms) INSERT INTO "blocks" ("type") VALUES (?) [["type", 2]]
873
+  (0.0ms) RELEASE SAVEPOINT active_record_1
874
+ Block Load (0.0ms) SELECT "blocks".* FROM "blocks" WHERE "blocks"."id" = ? LIMIT 1 [["id", 1]]
875
+ SQL (0.1ms) DELETE FROM "blocks" WHERE "blocks"."type" IN (1) AND "blocks"."id" = 1
876
+ SQL (0.1ms) DELETE FROM "blocks" WHERE "blocks"."type" IN (2) AND "blocks"."id" = 2
877
+  (0.9ms) rollback transaction
878
+  (0.0ms) begin transaction
879
+ --------------------------------------------------------------------
880
+ ActsAsRuintstiTest: test_when_create_block_type=2,_created_BlueBlock
881
+ --------------------------------------------------------------------
882
+  (0.0ms) SAVEPOINT active_record_1
883
+ SQL (0.2ms) INSERT INTO "blocks" ("type") VALUES (?) [["type", 1]]
884
+  (0.0ms) RELEASE SAVEPOINT active_record_1
885
+  (0.0ms) SAVEPOINT active_record_1
886
+ SQL (0.2ms) INSERT INTO "blocks" ("type") VALUES (?) [["type", 2]]
887
+  (0.0ms) RELEASE SAVEPOINT active_record_1
888
+ SQL (0.1ms) DELETE FROM "blocks" WHERE "blocks"."type" IN (1) AND "blocks"."id" = 1
889
+ SQL (0.1ms) DELETE FROM "blocks" WHERE "blocks"."type" IN (2) AND "blocks"."id" = 2
890
+  (0.6ms) rollback transaction
891
+  (0.3ms) begin transaction
892
+ ----------------------------------------------
893
+ ActsAsRuintstiTest: test_BlueBlock's_type_is_2
894
+ ----------------------------------------------
895
+  (0.0ms) SAVEPOINT active_record_1
896
+ SQL (2.1ms) INSERT INTO "blocks" ("type") VALUES (?) [["type", 1]]
897
+  (0.1ms) RELEASE SAVEPOINT active_record_1
898
+  (0.0ms) SAVEPOINT active_record_1
899
+ SQL (0.3ms) INSERT INTO "blocks" ("type") VALUES (?) [["type", 2]]
900
+  (0.1ms) RELEASE SAVEPOINT active_record_1
901
+ Block Load (0.1ms) SELECT "blocks".* FROM "blocks" WHERE "blocks"."id" = ? LIMIT 1 [["id", 2]]
902
+ SQL (0.1ms) DELETE FROM "blocks" WHERE "blocks"."type" IN (1) AND "blocks"."id" = 1
903
+ SQL (0.1ms) DELETE FROM "blocks" WHERE "blocks"."type" IN (2) AND "blocks"."id" = 2
904
+  (2.7ms) rollback transaction
905
+  (0.1ms) begin transaction
906
+ ---------------------------------------------
907
+ ActsAsRuintstiTest: test_RedBlock's_type_is_1
908
+ ---------------------------------------------
909
+  (0.0ms) SAVEPOINT active_record_1
910
+ SQL (0.3ms) INSERT INTO "blocks" ("type") VALUES (?) [["type", 1]]
911
+  (0.0ms) RELEASE SAVEPOINT active_record_1
912
+  (0.0ms) SAVEPOINT active_record_1
913
+ SQL (0.2ms) INSERT INTO "blocks" ("type") VALUES (?) [["type", 2]]
914
+  (0.1ms) RELEASE SAVEPOINT active_record_1
915
+ Block Load (0.0ms) SELECT "blocks".* FROM "blocks" WHERE "blocks"."id" = ? LIMIT 1 [["id", 1]]
916
+ SQL (0.1ms) DELETE FROM "blocks" WHERE "blocks"."type" IN (1) AND "blocks"."id" = 1
917
+ SQL (0.1ms) DELETE FROM "blocks" WHERE "blocks"."type" IN (2) AND "blocks"."id" = 2
918
+  (0.6ms) rollback transaction
919
+  (0.1ms) begin transaction
920
+ --------------------------------------------------------------
921
+ ActsAsRuintstiTest: test_loaded_BlueBlock's_class_is_BlueBlock
922
+ --------------------------------------------------------------
923
+  (0.1ms) SAVEPOINT active_record_1
924
+ SQL (0.3ms) INSERT INTO "blocks" ("type") VALUES (?) [["type", 1]]
925
+  (0.0ms) RELEASE SAVEPOINT active_record_1
926
+  (0.0ms) SAVEPOINT active_record_1
927
+ SQL (0.2ms) INSERT INTO "blocks" ("type") VALUES (?) [["type", 2]]
928
+  (0.0ms) RELEASE SAVEPOINT active_record_1
929
+ Block Load (0.1ms) SELECT "blocks".* FROM "blocks" WHERE "blocks"."id" = ? LIMIT 1 [["id", 2]]
930
+ SQL (0.2ms) DELETE FROM "blocks" WHERE "blocks"."type" IN (1) AND "blocks"."id" = 1
931
+ SQL (0.1ms) DELETE FROM "blocks" WHERE "blocks"."type" IN (2) AND "blocks"."id" = 2
932
+  (0.7ms) rollback transaction
933
+  (0.0ms) begin transaction
934
+ ------------------------------------------------------------
935
+ ActsAsRuintstiTest: test_loaded_RedBlock's_class_is_RedBlock
936
+ ------------------------------------------------------------
937
+  (0.0ms) SAVEPOINT active_record_1
938
+ SQL (0.2ms) INSERT INTO "blocks" ("type") VALUES (?) [["type", 1]]
939
+  (0.0ms) RELEASE SAVEPOINT active_record_1
940
+  (0.0ms) SAVEPOINT active_record_1
941
+ SQL (0.2ms) INSERT INTO "blocks" ("type") VALUES (?) [["type", 2]]
942
+  (0.0ms) RELEASE SAVEPOINT active_record_1
943
+ Block Load (0.0ms) SELECT "blocks".* FROM "blocks" WHERE "blocks"."id" = ? LIMIT 1 [["id", 1]]
944
+ SQL (0.1ms) DELETE FROM "blocks" WHERE "blocks"."type" IN (1) AND "blocks"."id" = 1
945
+ SQL (0.1ms) DELETE FROM "blocks" WHERE "blocks"."type" IN (2) AND "blocks"."id" = 2
946
+  (0.5ms) rollback transaction
947
+  (0.1ms) begin transaction
948
+ --------------------------------------------------------------------
949
+ ActsAsRuintstiTest: test_when_create_block_type=2,_created_BlueBlock
950
+ --------------------------------------------------------------------
951
+  (0.0ms) SAVEPOINT active_record_1
952
+ SQL (0.2ms) INSERT INTO "blocks" ("type") VALUES (?) [["type", 1]]
953
+  (0.1ms) RELEASE SAVEPOINT active_record_1
954
+  (0.0ms) SAVEPOINT active_record_1
955
+ SQL (0.2ms) INSERT INTO "blocks" ("type") VALUES (?) [["type", 2]]
956
+  (0.1ms) RELEASE SAVEPOINT active_record_1
957
+ SQL (0.1ms) DELETE FROM "blocks" WHERE "blocks"."type" IN (1) AND "blocks"."id" = 1
958
+ SQL (0.1ms) DELETE FROM "blocks" WHERE "blocks"."type" IN (2) AND "blocks"."id" = 2
959
+  (0.5ms) rollback transaction
960
+  (0.3ms) begin transaction
961
+ ----------------------------------------------
962
+ ActsAsRuintstiTest: test_BlueBlock's_type_is_2
963
+ ----------------------------------------------
964
+  (0.0ms) SAVEPOINT active_record_1
965
+ SQL (2.1ms) INSERT INTO "blocks" ("type") VALUES (?) [["type", 1]]
966
+  (0.1ms) RELEASE SAVEPOINT active_record_1
967
+  (0.0ms) SAVEPOINT active_record_1
968
+ SQL (0.3ms) INSERT INTO "blocks" ("type") VALUES (?) [["type", 2]]
969
+  (0.1ms) RELEASE SAVEPOINT active_record_1
970
+ Block Load (0.1ms) SELECT "blocks".* FROM "blocks" WHERE "blocks"."id" = ? LIMIT 1 [["id", 2]]
971
+ SQL (0.1ms) DELETE FROM "blocks" WHERE "blocks"."type" IN (1) AND "blocks"."id" = 1
972
+ SQL (0.1ms) DELETE FROM "blocks" WHERE "blocks"."type" IN (2) AND "blocks"."id" = 2
973
+  (2.5ms) rollback transaction
974
+  (0.1ms) begin transaction
975
+ ---------------------------------------------
976
+ ActsAsRuintstiTest: test_RedBlock's_type_is_1
977
+ ---------------------------------------------
978
+  (0.0ms) SAVEPOINT active_record_1
979
+ SQL (0.3ms) INSERT INTO "blocks" ("type") VALUES (?) [["type", 1]]
980
+  (0.0ms) RELEASE SAVEPOINT active_record_1
981
+  (0.0ms) SAVEPOINT active_record_1
982
+ SQL (0.2ms) INSERT INTO "blocks" ("type") VALUES (?) [["type", 2]]
983
+  (0.0ms) RELEASE SAVEPOINT active_record_1
984
+ Block Load (0.0ms) SELECT "blocks".* FROM "blocks" WHERE "blocks"."id" = ? LIMIT 1 [["id", 1]]
985
+ SQL (0.2ms) DELETE FROM "blocks" WHERE "blocks"."type" IN (1) AND "blocks"."id" = 1
986
+ SQL (0.1ms) DELETE FROM "blocks" WHERE "blocks"."type" IN (2) AND "blocks"."id" = 2
987
+  (0.6ms) rollback transaction
988
+  (0.1ms) begin transaction
989
+ --------------------------------------------------------------
990
+ ActsAsRuintstiTest: test_loaded_BlueBlock's_class_is_BlueBlock
991
+ --------------------------------------------------------------
992
+  (0.0ms) SAVEPOINT active_record_1
993
+ SQL (0.2ms) INSERT INTO "blocks" ("type") VALUES (?) [["type", 1]]
994
+  (0.0ms) RELEASE SAVEPOINT active_record_1
995
+  (0.0ms) SAVEPOINT active_record_1
996
+ SQL (0.2ms) INSERT INTO "blocks" ("type") VALUES (?) [["type", 2]]
997
+  (0.0ms) RELEASE SAVEPOINT active_record_1
998
+ Block Load (0.0ms) SELECT "blocks".* FROM "blocks" WHERE "blocks"."id" = ? LIMIT 1 [["id", 2]]
999
+ SQL (0.1ms) DELETE FROM "blocks" WHERE "blocks"."type" IN (1) AND "blocks"."id" = 1
1000
+ SQL (0.1ms) DELETE FROM "blocks" WHERE "blocks"."type" IN (2) AND "blocks"."id" = 2
1001
+  (0.6ms) rollback transaction
1002
+  (0.1ms) begin transaction
1003
+ ------------------------------------------------------------
1004
+ ActsAsRuintstiTest: test_loaded_RedBlock's_class_is_RedBlock
1005
+ ------------------------------------------------------------
1006
+  (0.1ms) SAVEPOINT active_record_1
1007
+ SQL (0.3ms) INSERT INTO "blocks" ("type") VALUES (?) [["type", 1]]
1008
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1009
+  (0.0ms) SAVEPOINT active_record_1
1010
+ SQL (0.2ms) INSERT INTO "blocks" ("type") VALUES (?) [["type", 2]]
1011
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1012
+ Block Load (0.0ms) SELECT "blocks".* FROM "blocks" WHERE "blocks"."id" = ? LIMIT 1 [["id", 1]]
1013
+ SQL (0.1ms) DELETE FROM "blocks" WHERE "blocks"."type" IN (1) AND "blocks"."id" = 1
1014
+ SQL (0.1ms) DELETE FROM "blocks" WHERE "blocks"."type" IN (2) AND "blocks"."id" = 2
1015
+  (0.5ms) rollback transaction
1016
+  (0.0ms) begin transaction
1017
+ --------------------------------------------------------------------
1018
+ ActsAsRuintstiTest: test_when_create_block_type=2,_created_BlueBlock
1019
+ --------------------------------------------------------------------
1020
+  (0.0ms) SAVEPOINT active_record_1
1021
+ SQL (0.2ms) INSERT INTO "blocks" ("type") VALUES (?) [["type", 1]]
1022
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1023
+  (0.0ms) SAVEPOINT active_record_1
1024
+ SQL (0.2ms) INSERT INTO "blocks" ("type") VALUES (?) [["type", 2]]
1025
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1026
+ SQL (0.1ms) DELETE FROM "blocks" WHERE "blocks"."type" IN (1) AND "blocks"."id" = 1
1027
+ SQL (0.1ms) DELETE FROM "blocks" WHERE "blocks"."type" IN (2) AND "blocks"."id" = 2
1028
+  (0.6ms) rollback transaction
1029
+  (0.3ms) begin transaction
1030
+ ----------------------------------------------
1031
+ ActsAsRuintstiTest: test_BlueBlock's_type_is_2
1032
+ ----------------------------------------------
1033
+  (0.0ms) SAVEPOINT active_record_1
1034
+ SQL (2.1ms) INSERT INTO "blocks" ("type") VALUES (?) [["type", 1]]
1035
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1036
+  (0.0ms) SAVEPOINT active_record_1
1037
+ SQL (0.3ms) INSERT INTO "blocks" ("type") VALUES (?) [["type", 2]]
1038
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1039
+ Block Load (0.1ms) SELECT "blocks".* FROM "blocks" WHERE "blocks"."id" = ? LIMIT 1 [["id", 2]]
1040
+ SQL (0.1ms) DELETE FROM "blocks" WHERE "blocks"."type" IN (1) AND "blocks"."id" = 1
1041
+ SQL (0.1ms) DELETE FROM "blocks" WHERE "blocks"."type" IN (2) AND "blocks"."id" = 2
1042
+  (2.8ms) rollback transaction
1043
+  (0.1ms) begin transaction
1044
+ ---------------------------------------------
1045
+ ActsAsRuintstiTest: test_RedBlock's_type_is_1
1046
+ ---------------------------------------------
1047
+  (0.0ms) SAVEPOINT active_record_1
1048
+ SQL (0.4ms) INSERT INTO "blocks" ("type") VALUES (?) [["type", 1]]
1049
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1050
+  (0.1ms) SAVEPOINT active_record_1
1051
+ SQL (0.3ms) INSERT INTO "blocks" ("type") VALUES (?) [["type", 2]]
1052
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1053
+ Block Load (0.1ms) SELECT "blocks".* FROM "blocks" WHERE "blocks"."id" = ? LIMIT 1 [["id", 1]]
1054
+ SQL (0.2ms) DELETE FROM "blocks" WHERE "blocks"."type" IN (1) AND "blocks"."id" = 1
1055
+ SQL (0.1ms) DELETE FROM "blocks" WHERE "blocks"."type" IN (2) AND "blocks"."id" = 2
1056
+  (0.6ms) rollback transaction
1057
+  (0.1ms) begin transaction
1058
+ --------------------------------------------------------------
1059
+ ActsAsRuintstiTest: test_loaded_BlueBlock's_class_is_BlueBlock
1060
+ --------------------------------------------------------------
1061
+  (0.0ms) SAVEPOINT active_record_1
1062
+ SQL (0.2ms) INSERT INTO "blocks" ("type") VALUES (?) [["type", 1]]
1063
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1064
+  (0.0ms) SAVEPOINT active_record_1
1065
+ SQL (0.2ms) INSERT INTO "blocks" ("type") VALUES (?) [["type", 2]]
1066
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1067
+ Block Load (0.0ms) SELECT "blocks".* FROM "blocks" WHERE "blocks"."id" = ? LIMIT 1 [["id", 2]]
1068
+ SQL (0.1ms) DELETE FROM "blocks" WHERE "blocks"."type" IN (1) AND "blocks"."id" = 1
1069
+ SQL (0.1ms) DELETE FROM "blocks" WHERE "blocks"."type" IN (2) AND "blocks"."id" = 2
1070
+  (0.6ms) rollback transaction
1071
+  (0.0ms) begin transaction
1072
+ ------------------------------------------------------------
1073
+ ActsAsRuintstiTest: test_loaded_RedBlock's_class_is_RedBlock
1074
+ ------------------------------------------------------------
1075
+  (0.0ms) SAVEPOINT active_record_1
1076
+ SQL (0.3ms) INSERT INTO "blocks" ("type") VALUES (?) [["type", 1]]
1077
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1078
+  (0.0ms) SAVEPOINT active_record_1
1079
+ SQL (0.3ms) INSERT INTO "blocks" ("type") VALUES (?) [["type", 2]]
1080
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1081
+ Block Load (0.1ms) SELECT "blocks".* FROM "blocks" WHERE "blocks"."id" = ? LIMIT 1 [["id", 1]]
1082
+ SQL (0.1ms) DELETE FROM "blocks" WHERE "blocks"."type" IN (1) AND "blocks"."id" = 1
1083
+ SQL (0.1ms) DELETE FROM "blocks" WHERE "blocks"."type" IN (2) AND "blocks"."id" = 2
1084
+  (0.6ms) rollback transaction
1085
+  (0.1ms) begin transaction
1086
+ -------------------------------------------------------------------
1087
+ ActsAsRuintstiTest: test_when_create_block_type=1,_created_RedBlock
1088
+ -------------------------------------------------------------------
1089
+  (0.0ms) SAVEPOINT active_record_1
1090
+ SQL (0.2ms) INSERT INTO "blocks" ("type") VALUES (?) [["type", 1]]
1091
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1092
+  (0.0ms) SAVEPOINT active_record_1
1093
+ SQL (0.2ms) INSERT INTO "blocks" ("type") VALUES (?) [["type", 2]]
1094
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1095
+ SQL (0.1ms) DELETE FROM "blocks" WHERE "blocks"."type" IN (1) AND "blocks"."id" = 1
1096
+ SQL (0.1ms) DELETE FROM "blocks" WHERE "blocks"."type" IN (2) AND "blocks"."id" = 2
1097
+  (0.5ms) rollback transaction
1098
+  (0.0ms) begin transaction
1099
+ --------------------------------------------------------------------
1100
+ ActsAsRuintstiTest: test_when_create_block_type=2,_created_BlueBlock
1101
+ --------------------------------------------------------------------
1102
+  (0.0ms) SAVEPOINT active_record_1
1103
+ SQL (0.2ms) INSERT INTO "blocks" ("type") VALUES (?) [["type", 1]]
1104
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1105
+  (0.1ms) SAVEPOINT active_record_1
1106
+ SQL (0.2ms) INSERT INTO "blocks" ("type") VALUES (?) [["type", 2]]
1107
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1108
+ SQL (0.1ms) DELETE FROM "blocks" WHERE "blocks"."type" IN (1) AND "blocks"."id" = 1
1109
+ SQL (0.1ms) DELETE FROM "blocks" WHERE "blocks"."type" IN (2) AND "blocks"."id" = 2
1110
+  (0.7ms) rollback transaction
1111
+  (0.3ms) begin transaction
1112
+ ----------------------------------------------
1113
+ ActsAsRuintstiTest: test_BlueBlock's_type_is_2
1114
+ ----------------------------------------------
1115
+  (0.1ms) SAVEPOINT active_record_1
1116
+ SQL (2.2ms) INSERT INTO "blocks" ("type") VALUES (?) [["type", 1]]
1117
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1118
+  (0.0ms) SAVEPOINT active_record_1
1119
+ SQL (0.3ms) INSERT INTO "blocks" ("type") VALUES (?) [["type", 2]]
1120
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1121
+ Block Load (0.1ms) SELECT "blocks".* FROM "blocks" WHERE "blocks"."id" = ? LIMIT 1 [["id", 2]]
1122
+ SQL (0.1ms) DELETE FROM "blocks" WHERE "blocks"."type" IN (1) AND "blocks"."id" = 1
1123
+ SQL (0.1ms) DELETE FROM "blocks" WHERE "blocks"."type" IN (2) AND "blocks"."id" = 2
1124
+  (2.6ms) rollback transaction
1125
+  (0.1ms) begin transaction
1126
+ ---------------------------------------------
1127
+ ActsAsRuintstiTest: test_RedBlock's_type_is_1
1128
+ ---------------------------------------------
1129
+  (0.0ms) SAVEPOINT active_record_1
1130
+ SQL (0.3ms) INSERT INTO "blocks" ("type") VALUES (?) [["type", 1]]
1131
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1132
+  (0.0ms) SAVEPOINT active_record_1
1133
+ SQL (0.2ms) INSERT INTO "blocks" ("type") VALUES (?) [["type", 2]]
1134
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1135
+ Block Load (0.0ms) SELECT "blocks".* FROM "blocks" WHERE "blocks"."id" = ? LIMIT 1 [["id", 1]]
1136
+ SQL (0.1ms) DELETE FROM "blocks" WHERE "blocks"."type" IN (1) AND "blocks"."id" = 1
1137
+ SQL (0.1ms) DELETE FROM "blocks" WHERE "blocks"."type" IN (2) AND "blocks"."id" = 2
1138
+  (0.5ms) rollback transaction
1139
+  (0.0ms) begin transaction
1140
+ --------------------------------------------------------------
1141
+ ActsAsRuintstiTest: test_loaded_BlueBlock's_class_is_BlueBlock
1142
+ --------------------------------------------------------------
1143
+  (0.0ms) SAVEPOINT active_record_1
1144
+ SQL (0.2ms) INSERT INTO "blocks" ("type") VALUES (?) [["type", 1]]
1145
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1146
+  (0.0ms) SAVEPOINT active_record_1
1147
+ SQL (0.3ms) INSERT INTO "blocks" ("type") VALUES (?) [["type", 2]]
1148
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1149
+ Block Load (0.0ms) SELECT "blocks".* FROM "blocks" WHERE "blocks"."id" = ? LIMIT 1 [["id", 2]]
1150
+ SQL (0.2ms) DELETE FROM "blocks" WHERE "blocks"."type" IN (1) AND "blocks"."id" = 1
1151
+ SQL (0.1ms) DELETE FROM "blocks" WHERE "blocks"."type" IN (2) AND "blocks"."id" = 2
1152
+  (0.7ms) rollback transaction
1153
+  (0.1ms) begin transaction
1154
+ ------------------------------------------------------------
1155
+ ActsAsRuintstiTest: test_loaded_RedBlock's_class_is_RedBlock
1156
+ ------------------------------------------------------------
1157
+  (0.0ms) SAVEPOINT active_record_1
1158
+ SQL (0.2ms) INSERT INTO "blocks" ("type") VALUES (?) [["type", 1]]
1159
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1160
+  (0.0ms) SAVEPOINT active_record_1
1161
+ SQL (0.2ms) INSERT INTO "blocks" ("type") VALUES (?) [["type", 2]]
1162
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1163
+ Block Load (0.1ms) SELECT "blocks".* FROM "blocks" WHERE "blocks"."id" = ? LIMIT 1 [["id", 1]]
1164
+ SQL (0.2ms) DELETE FROM "blocks" WHERE "blocks"."type" IN (1) AND "blocks"."id" = 1
1165
+ SQL (0.1ms) DELETE FROM "blocks" WHERE "blocks"."type" IN (2) AND "blocks"."id" = 2
1166
+  (0.6ms) rollback transaction
1167
+  (0.1ms) begin transaction
1168
+ -------------------------------------------------------------------
1169
+ ActsAsRuintstiTest: test_when_create_block_type=1,_created_RedBlock
1170
+ -------------------------------------------------------------------
1171
+  (0.1ms) SAVEPOINT active_record_1
1172
+ SQL (0.3ms) INSERT INTO "blocks" ("type") VALUES (?) [["type", 1]]
1173
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1174
+  (0.0ms) SAVEPOINT active_record_1
1175
+ SQL (0.2ms) INSERT INTO "blocks" ("type") VALUES (?) [["type", 2]]
1176
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1177
+ SQL (0.1ms) DELETE FROM "blocks" WHERE "blocks"."type" IN (1) AND "blocks"."id" = 1
1178
+ SQL (0.1ms) DELETE FROM "blocks" WHERE "blocks"."type" IN (2) AND "blocks"."id" = 2
1179
+  (0.5ms) rollback transaction
1180
+  (0.1ms) begin transaction
1181
+ --------------------------------------------------------------------
1182
+ ActsAsRuintstiTest: test_when_create_block_type=2,_created_BlueBlock
1183
+ --------------------------------------------------------------------
1184
+  (0.0ms) SAVEPOINT active_record_1
1185
+ SQL (0.2ms) INSERT INTO "blocks" ("type") VALUES (?) [["type", 1]]
1186
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1187
+  (0.0ms) SAVEPOINT active_record_1
1188
+ SQL (0.3ms) INSERT INTO "blocks" ("type") VALUES (?) [["type", 2]]
1189
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1190
+ SQL (0.1ms) DELETE FROM "blocks" WHERE "blocks"."type" IN (1) AND "blocks"."id" = 1
1191
+ SQL (0.1ms) DELETE FROM "blocks" WHERE "blocks"."type" IN (2) AND "blocks"."id" = 2
1192
+  (0.5ms) rollback transaction
1193
+  (0.0ms) begin transaction
1194
+ -------------------------------------------------------------------------
1195
+ ActsAsRuintstiTest: test_when_create_block_type=3,_raise_SubclassNotFound
1196
+ -------------------------------------------------------------------------
1197
+  (0.0ms) SAVEPOINT active_record_1
1198
+ SQL (0.2ms) INSERT INTO "blocks" ("type") VALUES (?) [["type", 1]]
1199
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1200
+  (0.0ms) SAVEPOINT active_record_1
1201
+ SQL (0.2ms) INSERT INTO "blocks" ("type") VALUES (?) [["type", 2]]
1202
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1203
+ SQL (0.1ms) DELETE FROM "blocks" WHERE "blocks"."type" IN (1) AND "blocks"."id" = 1
1204
+ SQL (0.1ms) DELETE FROM "blocks" WHERE "blocks"."type" IN (2) AND "blocks"."id" = 2
1205
+  (0.5ms) rollback transaction
1206
+  (0.3ms) begin transaction
1207
+ ----------------------------------------------
1208
+ ActsAsRuintstiTest: test_BlueBlock's_type_is_2
1209
+ ----------------------------------------------
1210
+  (0.0ms) SAVEPOINT active_record_1
1211
+ SQL (2.3ms) INSERT INTO "blocks" ("type") VALUES (?) [["type", 1]]
1212
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1213
+  (0.0ms) SAVEPOINT active_record_1
1214
+ SQL (0.3ms) INSERT INTO "blocks" ("type") VALUES (?) [["type", 2]]
1215
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1216
+ Block Load (0.1ms) SELECT "blocks".* FROM "blocks" WHERE "blocks"."id" = ? LIMIT 1 [["id", 2]]
1217
+ SQL (0.1ms) DELETE FROM "blocks" WHERE "blocks"."type" IN (1) AND "blocks"."id" = 1
1218
+ SQL (0.1ms) DELETE FROM "blocks" WHERE "blocks"."type" IN (2) AND "blocks"."id" = 2
1219
+  (2.0ms) rollback transaction
1220
+  (0.1ms) begin transaction
1221
+ ---------------------------------------------
1222
+ ActsAsRuintstiTest: test_RedBlock's_type_is_1
1223
+ ---------------------------------------------
1224
+  (0.0ms) SAVEPOINT active_record_1
1225
+ SQL (0.2ms) INSERT INTO "blocks" ("type") VALUES (?) [["type", 1]]
1226
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1227
+  (0.0ms) SAVEPOINT active_record_1
1228
+ SQL (0.2ms) INSERT INTO "blocks" ("type") VALUES (?) [["type", 2]]
1229
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1230
+ Block Load (0.0ms) SELECT "blocks".* FROM "blocks" WHERE "blocks"."id" = ? LIMIT 1 [["id", 1]]
1231
+ SQL (0.2ms) DELETE FROM "blocks" WHERE "blocks"."type" IN (1) AND "blocks"."id" = 1
1232
+ SQL (0.1ms) DELETE FROM "blocks" WHERE "blocks"."type" IN (2) AND "blocks"."id" = 2
1233
+  (0.7ms) rollback transaction
1234
+  (0.1ms) begin transaction
1235
+ --------------------------------------------------------------
1236
+ ActsAsRuintstiTest: test_loaded_BlueBlock's_class_is_BlueBlock
1237
+ --------------------------------------------------------------
1238
+  (0.0ms) SAVEPOINT active_record_1
1239
+ SQL (0.2ms) INSERT INTO "blocks" ("type") VALUES (?) [["type", 1]]
1240
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1241
+  (0.0ms) SAVEPOINT active_record_1
1242
+ SQL (0.3ms) INSERT INTO "blocks" ("type") VALUES (?) [["type", 2]]
1243
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1244
+ Block Load (0.0ms) SELECT "blocks".* FROM "blocks" WHERE "blocks"."id" = ? LIMIT 1 [["id", 2]]
1245
+ SQL (0.1ms) DELETE FROM "blocks" WHERE "blocks"."type" IN (1) AND "blocks"."id" = 1
1246
+ SQL (0.1ms) DELETE FROM "blocks" WHERE "blocks"."type" IN (2) AND "blocks"."id" = 2
1247
+  (0.5ms) rollback transaction
1248
+  (0.0ms) begin transaction
1249
+ ------------------------------------------------------------
1250
+ ActsAsRuintstiTest: test_loaded_RedBlock's_class_is_RedBlock
1251
+ ------------------------------------------------------------
1252
+  (0.0ms) SAVEPOINT active_record_1
1253
+ SQL (0.3ms) INSERT INTO "blocks" ("type") VALUES (?) [["type", 1]]
1254
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1255
+  (0.0ms) SAVEPOINT active_record_1
1256
+ SQL (0.2ms) INSERT INTO "blocks" ("type") VALUES (?) [["type", 2]]
1257
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1258
+ Block Load (0.0ms) SELECT "blocks".* FROM "blocks" WHERE "blocks"."id" = ? LIMIT 1 [["id", 1]]
1259
+ SQL (0.1ms) DELETE FROM "blocks" WHERE "blocks"."type" IN (1) AND "blocks"."id" = 1
1260
+ SQL (0.1ms) DELETE FROM "blocks" WHERE "blocks"."type" IN (2) AND "blocks"."id" = 2
1261
+  (0.5ms) rollback transaction
1262
+  (0.1ms) begin transaction
1263
+ -------------------------------------------------------------------
1264
+ ActsAsRuintstiTest: test_when_create_block_type=1,_created_RedBlock
1265
+ -------------------------------------------------------------------
1266
+  (0.1ms) SAVEPOINT active_record_1
1267
+ SQL (0.2ms) INSERT INTO "blocks" ("type") VALUES (?) [["type", 1]]
1268
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1269
+  (0.0ms) SAVEPOINT active_record_1
1270
+ SQL (0.2ms) INSERT INTO "blocks" ("type") VALUES (?) [["type", 2]]
1271
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1272
+ SQL (0.1ms) DELETE FROM "blocks" WHERE "blocks"."type" IN (1) AND "blocks"."id" = 1
1273
+ SQL (0.1ms) DELETE FROM "blocks" WHERE "blocks"."type" IN (2) AND "blocks"."id" = 2
1274
+  (0.5ms) rollback transaction
1275
+  (0.1ms) begin transaction
1276
+ --------------------------------------------------------------------
1277
+ ActsAsRuintstiTest: test_when_create_block_type=2,_created_BlueBlock
1278
+ --------------------------------------------------------------------
1279
+  (0.0ms) SAVEPOINT active_record_1
1280
+ SQL (0.2ms) INSERT INTO "blocks" ("type") VALUES (?) [["type", 1]]
1281
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1282
+  (0.0ms) SAVEPOINT active_record_1
1283
+ SQL (0.2ms) INSERT INTO "blocks" ("type") VALUES (?) [["type", 2]]
1284
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1285
+ SQL (0.1ms) DELETE FROM "blocks" WHERE "blocks"."type" IN (1) AND "blocks"."id" = 1
1286
+ SQL (0.1ms) DELETE FROM "blocks" WHERE "blocks"."type" IN (2) AND "blocks"."id" = 2
1287
+  (0.6ms) rollback transaction
1288
+  (0.1ms) begin transaction
1289
+ -------------------------------------------------------------------------
1290
+ ActsAsRuintstiTest: test_when_create_block_type=3,_raise_SubclassNotFound
1291
+ -------------------------------------------------------------------------
1292
+  (0.0ms) SAVEPOINT active_record_1
1293
+ SQL (0.2ms) INSERT INTO "blocks" ("type") VALUES (?) [["type", 1]]
1294
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1295
+  (0.0ms) SAVEPOINT active_record_1
1296
+ SQL (0.2ms) INSERT INTO "blocks" ("type") VALUES (?) [["type", 2]]
1297
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1298
+ SQL (0.1ms) DELETE FROM "blocks" WHERE "blocks"."type" IN (1) AND "blocks"."id" = 1
1299
+ SQL (0.1ms) DELETE FROM "blocks" WHERE "blocks"."type" IN (2) AND "blocks"."id" = 2
1300
+  (0.6ms) rollback transaction
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acts_as_ruintsti
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ru/MuckRu
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-17 00:00:00.000000000 Z
11
+ date: 2013-10-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails