soft_validate 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/soft_validate.rb +3 -3
- data/lib/soft_validate/version.rb +1 -1
- data/test/debug.log +148 -0
- data/test/soft_validate_test.rb +11 -0
- metadata +7 -6
data/lib/soft_validate.rb
CHANGED
@@ -17,15 +17,15 @@ module SoftValidate
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def soft_valid?
|
20
|
-
self.soft_attributes.all? { |a| !self.attributes[a.to_s].
|
20
|
+
self.soft_attributes.all? { |a| !self.attributes[a.to_s].blank? }
|
21
21
|
end
|
22
22
|
|
23
23
|
def soft_errors
|
24
|
-
Hash[ self.soft_attributes.map { |a| [a, "shouldn't be blank"] if self.attributes[a.to_s].
|
24
|
+
Hash[ self.soft_attributes.map { |a| [a, "shouldn't be blank"] if self.attributes[a.to_s].blank? } ]
|
25
25
|
end
|
26
26
|
|
27
27
|
def progress_count
|
28
|
-
self.soft_attributes.count { |a| !self.attributes[a.to_s].
|
28
|
+
self.soft_attributes.count { |a| !self.attributes[a.to_s].blank? }
|
29
29
|
end
|
30
30
|
|
31
31
|
def progress_percent
|
data/test/debug.log
CHANGED
@@ -39,3 +39,151 @@
|
|
39
39
|
[1m[35m (0.1ms)[0m CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
|
40
40
|
[1m[36m (0.1ms)[0m [1mSELECT version FROM "schema_migrations"[0m
|
41
41
|
[1m[35m (0.1ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('0')
|
42
|
+
[1m[36m (1.8ms)[0m [1mselect sqlite_version(*)[0m
|
43
|
+
[1m[35m (0.3ms)[0m CREATE TABLE "dumb_users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar(255), "first_name" varchar(255), "last_name" varchar(255))
|
44
|
+
[1m[36m (0.1ms)[0m [1mCREATE TABLE "non_validated_users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar(255)) [0m
|
45
|
+
[1m[35m (0.1ms)[0m CREATE TABLE "user_with_addresses" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar(255))
|
46
|
+
[1m[36m (0.1ms)[0m [1mCREATE TABLE "addresses" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "street" varchar(255), "city" varchar(255), "state" varchar(255), "zip" varchar(255)) [0m
|
47
|
+
[1m[35m (0.1ms)[0m CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
|
48
|
+
[1m[36m (0.0ms)[0m [1mPRAGMA index_list("schema_migrations")[0m
|
49
|
+
[1m[35m (0.1ms)[0m CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
|
50
|
+
[1m[36m (0.0ms)[0m [1mSELECT version FROM "schema_migrations"[0m
|
51
|
+
[1m[35m (0.1ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('0')
|
52
|
+
[1m[36m (1.1ms)[0m [1mselect sqlite_version(*)[0m
|
53
|
+
[1m[35m (0.3ms)[0m CREATE TABLE "dumb_users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar(255), "first_name" varchar(255), "last_name" varchar(255))
|
54
|
+
[1m[36m (0.1ms)[0m [1mCREATE TABLE "non_validated_users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar(255)) [0m
|
55
|
+
[1m[35m (0.1ms)[0m CREATE TABLE "user_with_addresses" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar(255))
|
56
|
+
[1m[36m (0.1ms)[0m [1mCREATE TABLE "addresses" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "street" varchar(255), "city" varchar(255), "state" varchar(255), "zip" varchar(255)) [0m
|
57
|
+
[1m[35m (0.1ms)[0m CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
|
58
|
+
[1m[36m (0.0ms)[0m [1mPRAGMA index_list("schema_migrations")[0m
|
59
|
+
[1m[35m (0.1ms)[0m CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
|
60
|
+
[1m[36m (0.0ms)[0m [1mSELECT version FROM "schema_migrations"[0m
|
61
|
+
[1m[35m (0.1ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('0')
|
62
|
+
[1m[36m (1.1ms)[0m [1mselect sqlite_version(*)[0m
|
63
|
+
[1m[35m (0.3ms)[0m CREATE TABLE "dumb_users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar(255), "first_name" varchar(255), "last_name" varchar(255))
|
64
|
+
[1m[36m (0.1ms)[0m [1mCREATE TABLE "non_validated_users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar(255)) [0m
|
65
|
+
[1m[35m (0.1ms)[0m CREATE TABLE "user_with_addresses" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar(255))
|
66
|
+
[1m[36m (0.1ms)[0m [1mCREATE TABLE "addresses" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "street" varchar(255), "city" varchar(255), "state" varchar(255), "zip" varchar(255)) [0m
|
67
|
+
[1m[35m (0.1ms)[0m CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
|
68
|
+
[1m[36m (0.0ms)[0m [1mPRAGMA index_list("schema_migrations")[0m
|
69
|
+
[1m[35m (0.1ms)[0m CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
|
70
|
+
[1m[36m (0.0ms)[0m [1mSELECT version FROM "schema_migrations"[0m
|
71
|
+
[1m[35m (0.1ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('0')
|
72
|
+
[1m[36m (1.0ms)[0m [1mselect sqlite_version(*)[0m
|
73
|
+
[1m[35m (0.3ms)[0m CREATE TABLE "dumb_users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar(255), "first_name" varchar(255), "last_name" varchar(255))
|
74
|
+
[1m[36m (0.1ms)[0m [1mCREATE TABLE "non_validated_users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar(255)) [0m
|
75
|
+
[1m[35m (0.1ms)[0m CREATE TABLE "user_with_addresses" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar(255))
|
76
|
+
[1m[36m (1.1ms)[0m [1mselect sqlite_version(*)[0m
|
77
|
+
[1m[35m (0.3ms)[0m CREATE TABLE "dumb_users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar(255), "first_name" varchar(255), "last_name" varchar(255))
|
78
|
+
[1m[36m (0.1ms)[0m [1mCREATE TABLE "non_validated_users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar(255)) [0m
|
79
|
+
[1m[35m (0.1ms)[0m CREATE TABLE "user_with_addresses" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar(255))
|
80
|
+
[1m[36m (0.1ms)[0m [1mCREATE TABLE "addresses" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "user_with_addresses_id" integer, "street" varchar(255), "city" varchar(255), "state" varchar(255), "zip" varchar(255)) [0m
|
81
|
+
[1m[35m (0.1ms)[0m CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
|
82
|
+
[1m[36m (0.0ms)[0m [1mPRAGMA index_list("schema_migrations")[0m
|
83
|
+
[1m[35m (0.1ms)[0m CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
|
84
|
+
[1m[36m (0.0ms)[0m [1mSELECT version FROM "schema_migrations"[0m
|
85
|
+
[1m[35m (0.1ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('0')
|
86
|
+
[1m[36m (1.0ms)[0m [1mselect sqlite_version(*)[0m
|
87
|
+
[1m[35m (0.3ms)[0m CREATE TABLE "dumb_users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar(255), "first_name" varchar(255), "last_name" varchar(255))
|
88
|
+
[1m[36m (0.1ms)[0m [1mCREATE TABLE "non_validated_users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar(255)) [0m
|
89
|
+
[1m[35m (0.1ms)[0m CREATE TABLE "user_with_addresses" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar(255))
|
90
|
+
[1m[36m (0.1ms)[0m [1mCREATE TABLE "addresses" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "user_with_addresses_id" integer, "street" varchar(255), "city" varchar(255), "state" varchar(255), "zip" varchar(255)) [0m
|
91
|
+
[1m[35m (0.1ms)[0m CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
|
92
|
+
[1m[36m (0.0ms)[0m [1mPRAGMA index_list("schema_migrations")[0m
|
93
|
+
[1m[35m (0.1ms)[0m CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
|
94
|
+
[1m[36m (0.0ms)[0m [1mSELECT version FROM "schema_migrations"[0m
|
95
|
+
[1m[35m (0.1ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('0')
|
96
|
+
[1m[36m (1.1ms)[0m [1mselect sqlite_version(*)[0m
|
97
|
+
[1m[35m (0.3ms)[0m CREATE TABLE "dumb_users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar(255), "first_name" varchar(255), "last_name" varchar(255))
|
98
|
+
[1m[36m (0.1ms)[0m [1mCREATE TABLE "non_validated_users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar(255)) [0m
|
99
|
+
[1m[35m (0.1ms)[0m CREATE TABLE "user_with_addresses" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar(255))
|
100
|
+
[1m[36m (0.1ms)[0m [1mCREATE TABLE "addresses" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "user_with_addresses_id" integer, "street" varchar(255), "city" varchar(255), "state" varchar(255), "zip" varchar(255)) [0m
|
101
|
+
[1m[35m (0.1ms)[0m CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
|
102
|
+
[1m[36m (0.0ms)[0m [1mPRAGMA index_list("schema_migrations")[0m
|
103
|
+
[1m[35m (0.1ms)[0m CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
|
104
|
+
[1m[36m (0.0ms)[0m [1mSELECT version FROM "schema_migrations"[0m
|
105
|
+
[1m[35m (0.1ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('0')
|
106
|
+
[1m[36m (1.4ms)[0m [1mselect sqlite_version(*)[0m
|
107
|
+
[1m[35m (0.3ms)[0m CREATE TABLE "dumb_users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar(255), "first_name" varchar(255), "last_name" varchar(255))
|
108
|
+
[1m[36m (0.1ms)[0m [1mCREATE TABLE "non_validated_users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar(255)) [0m
|
109
|
+
[1m[35m (0.1ms)[0m CREATE TABLE "user_with_addresses" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar(255))
|
110
|
+
[1m[36m (0.1ms)[0m [1mCREATE TABLE "addresses" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "user_with_addresses_id" integer, "street" varchar(255), "city" varchar(255), "state" varchar(255), "zip" varchar(255)) [0m
|
111
|
+
[1m[35m (0.1ms)[0m CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
|
112
|
+
[1m[36m (0.0ms)[0m [1mPRAGMA index_list("schema_migrations")[0m
|
113
|
+
[1m[35m (0.1ms)[0m CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
|
114
|
+
[1m[36m (0.0ms)[0m [1mSELECT version FROM "schema_migrations"[0m
|
115
|
+
[1m[35m (0.1ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('0')
|
116
|
+
[1m[36m (1.1ms)[0m [1mselect sqlite_version(*)[0m
|
117
|
+
[1m[35m (0.3ms)[0m CREATE TABLE "dumb_users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar(255), "first_name" varchar(255), "last_name" varchar(255))
|
118
|
+
[1m[36m (0.1ms)[0m [1mCREATE TABLE "non_validated_users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar(255)) [0m
|
119
|
+
[1m[35m (0.1ms)[0m CREATE TABLE "user_with_addresses" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar(255))
|
120
|
+
[1m[36m (0.2ms)[0m [1mCREATE TABLE "addresses" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "user_with_addresses_id" integer, "street" varchar(255), "city" varchar(255), "state" varchar(255), "zip" varchar(255)) [0m
|
121
|
+
[1m[35m (0.2ms)[0m CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
|
122
|
+
[1m[36m (0.0ms)[0m [1mPRAGMA index_list("schema_migrations")[0m
|
123
|
+
[1m[35m (0.1ms)[0m CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
|
124
|
+
[1m[36m (0.0ms)[0m [1mSELECT version FROM "schema_migrations"[0m
|
125
|
+
[1m[35m (0.1ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('0')
|
126
|
+
[1m[36m (1.8ms)[0m [1mselect sqlite_version(*)[0m
|
127
|
+
[1m[35m (0.5ms)[0m CREATE TABLE "dumb_users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar(255), "first_name" varchar(255), "last_name" varchar(255))
|
128
|
+
[1m[36m (0.2ms)[0m [1mCREATE TABLE "non_validated_users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar(255)) [0m
|
129
|
+
[1m[35m (0.2ms)[0m CREATE TABLE "user_with_addresses" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar(255))
|
130
|
+
[1m[36m (0.1ms)[0m [1mCREATE TABLE "addresses" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "user_with_addresses_id" integer, "street" varchar(255), "city" varchar(255), "state" varchar(255), "zip" varchar(255)) [0m
|
131
|
+
[1m[35m (0.2ms)[0m CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
|
132
|
+
[1m[36m (0.0ms)[0m [1mPRAGMA index_list("schema_migrations")[0m
|
133
|
+
[1m[35m (0.2ms)[0m CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
|
134
|
+
[1m[36m (0.1ms)[0m [1mSELECT version FROM "schema_migrations"[0m
|
135
|
+
[1m[35m (0.1ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('0')
|
136
|
+
[1m[36m (1.0ms)[0m [1mselect sqlite_version(*)[0m
|
137
|
+
[1m[35m (0.3ms)[0m CREATE TABLE "dumb_users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar(255), "first_name" varchar(255), "last_name" varchar(255))
|
138
|
+
[1m[36m (0.1ms)[0m [1mCREATE TABLE "non_validated_users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar(255)) [0m
|
139
|
+
[1m[35m (0.1ms)[0m CREATE TABLE "user_with_addresses" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar(255))
|
140
|
+
[1m[36m (0.1ms)[0m [1mCREATE TABLE "addresses" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "user_with_addresses_id" integer, "street" varchar(255), "city" varchar(255), "state" varchar(255), "zip" varchar(255)) [0m
|
141
|
+
[1m[35m (0.1ms)[0m CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
|
142
|
+
[1m[36m (0.0ms)[0m [1mPRAGMA index_list("schema_migrations")[0m
|
143
|
+
[1m[35m (0.1ms)[0m CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
|
144
|
+
[1m[36m (0.0ms)[0m [1mSELECT version FROM "schema_migrations"[0m
|
145
|
+
[1m[35m (0.1ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('0')
|
146
|
+
[1m[36m (1.1ms)[0m [1mselect sqlite_version(*)[0m
|
147
|
+
[1m[35m (0.3ms)[0m CREATE TABLE "dumb_users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar(255), "first_name" varchar(255), "last_name" varchar(255))
|
148
|
+
[1m[36m (0.1ms)[0m [1mCREATE TABLE "non_validated_users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar(255)) [0m
|
149
|
+
[1m[35m (0.1ms)[0m CREATE TABLE "user_with_addresses" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar(255))
|
150
|
+
[1m[36m (0.1ms)[0m [1mCREATE TABLE "addresses" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "user_with_address_id" integer, "street" varchar(255), "city" varchar(255), "state" varchar(255), "zip" varchar(255)) [0m
|
151
|
+
[1m[35m (0.1ms)[0m CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
|
152
|
+
[1m[36m (0.0ms)[0m [1mPRAGMA index_list("schema_migrations")[0m
|
153
|
+
[1m[35m (0.1ms)[0m CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
|
154
|
+
[1m[36m (0.0ms)[0m [1mSELECT version FROM "schema_migrations"[0m
|
155
|
+
[1m[35m (0.1ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('0')
|
156
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
157
|
+
[1m[35m (0.0ms)[0m commit transaction
|
158
|
+
[1m[36m (2.1ms)[0m [1mselect sqlite_version(*)[0m
|
159
|
+
[1m[35m (0.5ms)[0m CREATE TABLE "dumb_users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar(255), "first_name" varchar(255), "last_name" varchar(255))
|
160
|
+
[1m[36m (0.2ms)[0m [1mCREATE TABLE "non_validated_users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar(255)) [0m
|
161
|
+
[1m[35m (0.2ms)[0m CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
|
162
|
+
[1m[36m (0.0ms)[0m [1mPRAGMA index_list("schema_migrations")[0m
|
163
|
+
[1m[35m (0.2ms)[0m CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
|
164
|
+
[1m[36m (0.1ms)[0m [1mSELECT version FROM "schema_migrations"[0m
|
165
|
+
[1m[35m (0.1ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('0')
|
166
|
+
[1m[36m (1.3ms)[0m [1mselect sqlite_version(*)[0m
|
167
|
+
[1m[35m (0.3ms)[0m CREATE TABLE "dumb_users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar(255), "first_name" varchar(255), "last_name" varchar(255))
|
168
|
+
[1m[36m (0.1ms)[0m [1mCREATE TABLE "non_validated_users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar(255)) [0m
|
169
|
+
[1m[35m (0.1ms)[0m CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
|
170
|
+
[1m[36m (0.0ms)[0m [1mPRAGMA index_list("schema_migrations")[0m
|
171
|
+
[1m[35m (0.1ms)[0m CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
|
172
|
+
[1m[36m (0.1ms)[0m [1mSELECT version FROM "schema_migrations"[0m
|
173
|
+
[1m[35m (0.1ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('0')
|
174
|
+
[1m[36m (1.3ms)[0m [1mselect sqlite_version(*)[0m
|
175
|
+
[1m[35m (0.3ms)[0m CREATE TABLE "dumb_users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar(255), "first_name" varchar(255), "last_name" varchar(255))
|
176
|
+
[1m[36m (0.1ms)[0m [1mCREATE TABLE "non_validated_users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar(255)) [0m
|
177
|
+
[1m[35m (0.2ms)[0m CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
|
178
|
+
[1m[36m (0.0ms)[0m [1mPRAGMA index_list("schema_migrations")[0m
|
179
|
+
[1m[35m (0.1ms)[0m CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
|
180
|
+
[1m[36m (0.1ms)[0m [1mSELECT version FROM "schema_migrations"[0m
|
181
|
+
[1m[35m (0.1ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('0')
|
182
|
+
[1m[36m (2.7ms)[0m [1mselect sqlite_version(*)[0m
|
183
|
+
[1m[35m (0.4ms)[0m CREATE TABLE "dumb_users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar(255), "first_name" varchar(255), "last_name" varchar(255))
|
184
|
+
[1m[36m (0.2ms)[0m [1mCREATE TABLE "non_validated_users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar(255)) [0m
|
185
|
+
[1m[35m (0.1ms)[0m CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
|
186
|
+
[1m[36m (0.0ms)[0m [1mPRAGMA index_list("schema_migrations")[0m
|
187
|
+
[1m[35m (0.1ms)[0m CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
|
188
|
+
[1m[36m (0.1ms)[0m [1mSELECT version FROM "schema_migrations"[0m
|
189
|
+
[1m[35m (0.1ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('0')
|
data/test/soft_validate_test.rb
CHANGED
@@ -34,6 +34,17 @@ class SoftValidateTest < TEST_CASE
|
|
34
34
|
assert response[:last_name].eql?("shouldn't be blank")
|
35
35
|
end
|
36
36
|
|
37
|
+
test 'an invalid user should return error messages for blank values, not just nils' do
|
38
|
+
user = DumbUser.new(:email => '', :first_name => '', :last_name => '')
|
39
|
+
|
40
|
+
response = user.soft_errors
|
41
|
+
assert !response.nil?
|
42
|
+
assert !response.empty?
|
43
|
+
|
44
|
+
assert response[:first_name].eql?("shouldn't be blank")
|
45
|
+
assert response[:last_name].eql?("shouldn't be blank")
|
46
|
+
end
|
47
|
+
|
37
48
|
test 'a valid user should return an empty error message response' do
|
38
49
|
user = DumbUser.new(:email => 'me@you.com', :first_name => 'joe', :last_name => 'schmoe')
|
39
50
|
assert user.soft_errors.empty?
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: soft_validate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,11 +10,11 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-
|
13
|
+
date: 2012-05-18 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails
|
17
|
-
requirement: &
|
17
|
+
requirement: &70200595269100 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ~>
|
@@ -22,10 +22,10 @@ dependencies:
|
|
22
22
|
version: 3.2.3
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *70200595269100
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: sqlite3
|
28
|
-
requirement: &
|
28
|
+
requirement: &70200595268680 !ruby/object:Gem::Requirement
|
29
29
|
none: false
|
30
30
|
requirements:
|
31
31
|
- - ! '>='
|
@@ -33,7 +33,7 @@ dependencies:
|
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
|
-
version_requirements: *
|
36
|
+
version_requirements: *70200595268680
|
37
37
|
description: Add softs_validate_presence_of :attr to your model and it will give you
|
38
38
|
methods to figure out percent complete, missing fields, etc without preventing the
|
39
39
|
record from being saved.
|
@@ -96,3 +96,4 @@ test_files:
|
|
96
96
|
- test/schema.rb
|
97
97
|
- test/soft_validate_test.rb
|
98
98
|
- test/test_helper.rb
|
99
|
+
has_rdoc:
|