genderize 0.0.5 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/genderize.rb +2 -1
- data/lib/genderize/gender.rb +4 -2
- data/lib/genderize/version.rb +1 -1
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/development.log +11 -0
- data/spec/dummy/log/test.log +29 -255
- data/spec/dummy/spec/models/user_spec.rb +8 -0
- data/spec/lib/gender_spec.rb +10 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fb0f9371760b224246e156a4c38f010df1e7e56a
|
4
|
+
data.tar.gz: f9a43ab985038479e2b1ec4eb712db849004d845
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 463b88c489a86cdabf90ae3eb3f9b818e3b8177cda066ce1cf5b56f3332fec2fa5e9b41b8c7ff9e07268bf8a074be9390c7349d08bab4e8c45427a08316f5318
|
7
|
+
data.tar.gz: 0bb8dcf6ba581f3436afa2b8fbed28a49018a7e242d895151e50732128e018e17f6b5e5e1a77e924477546df2ff143197140cff9ca9508a2020ac80594fdc525
|
data/lib/genderize.rb
CHANGED
@@ -40,7 +40,8 @@ module Genderize
|
|
40
40
|
#
|
41
41
|
# Raises ArgumentError if gender is not a single alphanumeric character "m" or "f"
|
42
42
|
define_method "#{col_name}=" do |string|
|
43
|
-
|
43
|
+
string = string.to_s.first
|
44
|
+
unless string.to_s =~ /\A(m|f)\Z/i
|
44
45
|
raise ArgumentError, "Gender must be a single alphanumeric character"
|
45
46
|
end
|
46
47
|
write_attribute(col_name, string)
|
data/lib/genderize/gender.rb
CHANGED
@@ -6,8 +6,10 @@ module Genderize
|
|
6
6
|
attr_reader :abbr
|
7
7
|
|
8
8
|
def initialize(abbr)
|
9
|
-
|
10
|
-
|
9
|
+
unless abbr.blank? or abbr.to_s =~ /\A(f|m|female|male)\Z/i
|
10
|
+
raise "Invalid abbreviation: '#{abbr}'"
|
11
|
+
end
|
12
|
+
@abbr = abbr.blank? ? nil : abbr.to_s.first.downcase
|
11
13
|
end
|
12
14
|
|
13
15
|
def name
|
data/lib/genderize/version.rb
CHANGED
Binary file
|
data/spec/dummy/db/test.sqlite3
CHANGED
Binary file
|
@@ -0,0 +1,11 @@
|
|
1
|
+
[1m[36m (2.5ms)[0m [1mCREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) [0m
|
2
|
+
[1m[35m (3.2ms)[0m CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
|
3
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.2ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
4
|
+
Migrating to CreateUsers (20130506080641)
|
5
|
+
[1m[35m (0.1ms)[0m begin transaction
|
6
|
+
[1m[36m (0.4ms)[0m [1mCREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(20) NOT NULL, "gender" varchar(1) NOT NULL, "created_at" datetime, "updated_at" datetime) [0m
|
7
|
+
[1m[35mSQL (0.2ms)[0m INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20130506080641"]]
|
8
|
+
[1m[36m (3.5ms)[0m [1mcommit transaction[0m
|
9
|
+
[1m[35mActiveRecord::SchemaMigration Load (0.1ms)[0m SELECT "schema_migrations".* FROM "schema_migrations"
|
10
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
11
|
+
[1m[35mActiveRecord::SchemaMigration Load (0.1ms)[0m SELECT "schema_migrations".* FROM "schema_migrations"
|
data/spec/dummy/log/test.log
CHANGED
@@ -1,271 +1,45 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
Parameters: {"user"=>{"new"=>"MyString"}}
|
5
|
-
Completed 500 Internal Server Error in 0ms
|
6
|
-
Processing by UsersController#create as HTML
|
7
|
-
Parameters: {"user"=>{"new"=>"MyString"}}
|
8
|
-
Completed 500 Internal Server Error in 0ms
|
9
|
-
Processing by UsersController#create as HTML
|
10
|
-
Parameters: {"user"=>{"new"=>"invalid value"}}
|
11
|
-
Completed 500 Internal Server Error in 0ms
|
12
|
-
Processing by UsersController#create as HTML
|
13
|
-
Parameters: {"user"=>{"new"=>"invalid value"}}
|
14
|
-
Completed 500 Internal Server Error in 0ms
|
15
|
-
Started GET "/users" for 127.0.0.1 at 2013-12-10 11:50:53 +0000
|
16
|
-
Processing by UsersController#index as HTML
|
17
|
-
[1m[36mUser Load (0.3ms)[0m [1mSELECT "users".* FROM "users"[0m
|
18
|
-
SQLite3::SQLException: no such table: users: SELECT "users".* FROM "users"
|
19
|
-
Completed 500 Internal Server Error in 9ms
|
20
|
-
Processing by UsersController#new as HTML
|
21
|
-
Completed 500 Internal Server Error in 0ms
|
22
|
-
Processing by UsersController#create as HTML
|
23
|
-
Parameters: {"user"=>{"new"=>"MyString"}}
|
24
|
-
Completed 500 Internal Server Error in 0ms
|
25
|
-
Processing by UsersController#create as HTML
|
26
|
-
Parameters: {"user"=>{"new"=>"MyString"}}
|
27
|
-
Completed 500 Internal Server Error in 0ms
|
28
|
-
Processing by UsersController#create as HTML
|
29
|
-
Parameters: {"user"=>{"new"=>"invalid value"}}
|
30
|
-
Completed 500 Internal Server Error in 0ms
|
31
|
-
Processing by UsersController#create as HTML
|
32
|
-
Parameters: {"user"=>{"new"=>"invalid value"}}
|
33
|
-
Completed 500 Internal Server Error in 0ms
|
34
|
-
Started GET "/users" for 127.0.0.1 at 2013-12-10 11:51:05 +0000
|
35
|
-
Processing by UsersController#index as HTML
|
36
|
-
[1m[36mUser Load (0.3ms)[0m [1mSELECT "users".* FROM "users"[0m
|
37
|
-
SQLite3::SQLException: no such table: users: SELECT "users".* FROM "users"
|
38
|
-
Completed 500 Internal Server Error in 8ms
|
39
|
-
[1m[36m (55.2ms)[0m [1mCREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) [0m
|
40
|
-
[1m[35m (3.7ms)[0m CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
|
41
|
-
[1m[36mActiveRecord::SchemaMigration Load (0.2ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
1
|
+
[1m[36m (54.5ms)[0m [1mCREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) [0m
|
2
|
+
[1m[35m (2.4ms)[0m CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
|
3
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
42
4
|
Migrating to CreateUsers (20130506080641)
|
43
5
|
[1m[35m (0.1ms)[0m begin transaction
|
44
6
|
[1m[36m (0.5ms)[0m [1mCREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(20) NOT NULL, "gender" varchar(1) NOT NULL, "created_at" datetime, "updated_at" datetime) [0m
|
45
7
|
[1m[35mSQL (0.3ms)[0m INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20130506080641"]]
|
46
|
-
[1m[36m (
|
8
|
+
[1m[36m (3.0ms)[0m [1mcommit transaction[0m
|
47
9
|
[1m[35mActiveRecord::SchemaMigration Load (0.1ms)[0m SELECT "schema_migrations".* FROM "schema_migrations"
|
48
|
-
WARNING: Can't mass-assign protected attributes for User: new
|
49
|
-
|
50
10
|
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
51
|
-
[1m[35mSQL (
|
52
|
-
|
53
|
-
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
54
|
-
WARNING: Can't mass-assign protected attributes for User: new
|
55
|
-
|
56
|
-
[1m[35m (0.1ms)[0m begin transaction
|
57
|
-
[1m[36mSQL (0.3ms)[0m [1mINSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?)[0m [["created_at", Tue, 10 Dec 2013 11:51:38 UTC +00:00], ["updated_at", Tue, 10 Dec 2013 11:51:38 UTC +00:00]]
|
58
|
-
SQLite3::ConstraintException: users.name may not be NULL: INSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?)
|
59
|
-
[1m[35m (0.0ms)[0m rollback transaction
|
60
|
-
Processing by UsersController#new as HTML
|
61
|
-
Completed 200 OK in 4ms (Views: 3.9ms | ActiveRecord: 0.0ms)
|
62
|
-
WARNING: Can't mass-assign protected attributes for User: new
|
63
|
-
|
64
|
-
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
65
|
-
[1m[35mSQL (0.3ms)[0m INSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?) [["created_at", Tue, 10 Dec 2013 11:51:38 UTC +00:00], ["updated_at", Tue, 10 Dec 2013 11:51:38 UTC +00:00]]
|
66
|
-
SQLite3::ConstraintException: users.name may not be NULL: INSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?)
|
67
|
-
[1m[36m (0.0ms)[0m [1mrollback transaction[0m
|
68
|
-
[1m[35m (0.1ms)[0m SELECT COUNT(*) FROM "users"
|
69
|
-
Processing by UsersController#create as HTML
|
70
|
-
Parameters: {"user"=>{"new"=>"MyString"}}
|
71
|
-
WARNING: Can't mass-assign protected attributes for User: new
|
72
|
-
app/controllers/users_controller.rb:43:in `create'
|
73
|
-
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
74
|
-
[1m[35mSQL (0.9ms)[0m INSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?) [["created_at", Tue, 10 Dec 2013 11:51:38 UTC +00:00], ["updated_at", Tue, 10 Dec 2013 11:51:38 UTC +00:00]]
|
75
|
-
SQLite3::ConstraintException: users.name may not be NULL: INSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?)
|
76
|
-
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
77
|
-
Completed 500 Internal Server Error in 3ms
|
78
|
-
Processing by UsersController#create as HTML
|
79
|
-
Parameters: {"user"=>{"new"=>"MyString"}}
|
80
|
-
WARNING: Can't mass-assign protected attributes for User: new
|
81
|
-
app/controllers/users_controller.rb:43:in `create'
|
82
|
-
[1m[35m (0.1ms)[0m begin transaction
|
83
|
-
[1m[36mSQL (0.3ms)[0m [1mINSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?)[0m [["created_at", Tue, 10 Dec 2013 11:51:38 UTC +00:00], ["updated_at", Tue, 10 Dec 2013 11:51:38 UTC +00:00]]
|
84
|
-
SQLite3::ConstraintException: users.name may not be NULL: INSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?)
|
85
|
-
[1m[35m (0.1ms)[0m rollback transaction
|
86
|
-
Completed 500 Internal Server Error in 3ms
|
87
|
-
Processing by UsersController#create as HTML
|
88
|
-
Parameters: {"user"=>{"new"=>"MyString"}}
|
89
|
-
WARNING: Can't mass-assign protected attributes for User: new
|
90
|
-
app/controllers/users_controller.rb:43:in `create'
|
91
|
-
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
92
|
-
[1m[35mSQL (0.3ms)[0m INSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?) [["created_at", Tue, 10 Dec 2013 11:51:38 UTC +00:00], ["updated_at", Tue, 10 Dec 2013 11:51:38 UTC +00:00]]
|
93
|
-
SQLite3::ConstraintException: users.name may not be NULL: INSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?)
|
94
|
-
[1m[36m (0.0ms)[0m [1mrollback transaction[0m
|
95
|
-
Completed 500 Internal Server Error in 4ms
|
96
|
-
Processing by UsersController#create as HTML
|
97
|
-
Parameters: {"user"=>{"new"=>"invalid value"}}
|
98
|
-
WARNING: Can't mass-assign protected attributes for User: new
|
99
|
-
app/controllers/users_controller.rb:43:in `create'
|
100
|
-
Completed 200 OK in 2ms (Views: 0.5ms | ActiveRecord: 0.0ms)
|
101
|
-
Processing by UsersController#create as HTML
|
102
|
-
Parameters: {"user"=>{"new"=>"invalid value"}}
|
103
|
-
WARNING: Can't mass-assign protected attributes for User: new
|
104
|
-
app/controllers/users_controller.rb:43:in `create'
|
105
|
-
Completed 200 OK in 3ms (Views: 0.7ms | ActiveRecord: 0.0ms)
|
106
|
-
WARNING: Can't mass-assign protected attributes for User: new
|
107
|
-
|
108
|
-
[1m[35m (0.1ms)[0m begin transaction
|
109
|
-
[1m[36mSQL (0.3ms)[0m [1mINSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?)[0m [["created_at", Tue, 10 Dec 2013 11:51:38 UTC +00:00], ["updated_at", Tue, 10 Dec 2013 11:51:38 UTC +00:00]]
|
110
|
-
SQLite3::ConstraintException: users.name may not be NULL: INSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?)
|
111
|
-
[1m[35m (0.0ms)[0m rollback transaction
|
112
|
-
WARNING: Can't mass-assign protected attributes for User: new
|
113
|
-
|
114
|
-
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
115
|
-
[1m[35mSQL (0.3ms)[0m INSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?) [["created_at", Tue, 10 Dec 2013 11:51:38 UTC +00:00], ["updated_at", Tue, 10 Dec 2013 11:51:38 UTC +00:00]]
|
116
|
-
SQLite3::ConstraintException: users.name may not be NULL: INSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?)
|
117
|
-
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
118
|
-
WARNING: Can't mass-assign protected attributes for User: new
|
119
|
-
|
120
|
-
[1m[35m (0.1ms)[0m begin transaction
|
121
|
-
[1m[36mSQL (0.3ms)[0m [1mINSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?)[0m [["created_at", Tue, 10 Dec 2013 11:51:38 UTC +00:00], ["updated_at", Tue, 10 Dec 2013 11:51:38 UTC +00:00]]
|
122
|
-
SQLite3::ConstraintException: users.name may not be NULL: INSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?)
|
123
|
-
[1m[35m (0.1ms)[0m rollback transaction
|
124
|
-
WARNING: Can't mass-assign protected attributes for User: new
|
125
|
-
|
126
|
-
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
127
|
-
[1m[35mSQL (0.3ms)[0m INSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?) [["created_at", Tue, 10 Dec 2013 11:51:38 UTC +00:00], ["updated_at", Tue, 10 Dec 2013 11:51:38 UTC +00:00]]
|
128
|
-
SQLite3::ConstraintException: users.name may not be NULL: INSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?)
|
129
|
-
[1m[36m (0.0ms)[0m [1mrollback transaction[0m
|
130
|
-
WARNING: Can't mass-assign protected attributes for User: new
|
131
|
-
|
132
|
-
[1m[35m (0.0ms)[0m begin transaction
|
133
|
-
[1m[36mSQL (0.2ms)[0m [1mINSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?)[0m [["created_at", Tue, 10 Dec 2013 11:51:38 UTC +00:00], ["updated_at", Tue, 10 Dec 2013 11:51:38 UTC +00:00]]
|
134
|
-
SQLite3::ConstraintException: users.name may not be NULL: INSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?)
|
135
|
-
[1m[35m (0.0ms)[0m rollback transaction
|
136
|
-
WARNING: Can't mass-assign protected attributes for User: new
|
137
|
-
|
138
|
-
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
139
|
-
[1m[35mSQL (0.3ms)[0m INSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?) [["created_at", Tue, 10 Dec 2013 11:51:38 UTC +00:00], ["updated_at", Tue, 10 Dec 2013 11:51:38 UTC +00:00]]
|
140
|
-
SQLite3::ConstraintException: users.name may not be NULL: INSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?)
|
141
|
-
[1m[36m (0.0ms)[0m [1mrollback transaction[0m
|
142
|
-
WARNING: Can't mass-assign protected attributes for User: new
|
143
|
-
|
144
|
-
[1m[35m (0.1ms)[0m begin transaction
|
145
|
-
[1m[36mSQL (0.2ms)[0m [1mINSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?)[0m [["created_at", Tue, 10 Dec 2013 11:51:38 UTC +00:00], ["updated_at", Tue, 10 Dec 2013 11:51:38 UTC +00:00]]
|
146
|
-
SQLite3::ConstraintException: users.name may not be NULL: INSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?)
|
147
|
-
[1m[35m (0.0ms)[0m rollback transaction
|
148
|
-
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
149
|
-
[1m[35mSQL (0.4ms)[0m INSERT INTO "users" ("created_at", "gender", "name", "updated_at") VALUES (?, ?, ?, ?) [["created_at", Tue, 10 Dec 2013 11:51:38 UTC +00:00], ["gender", "f"], ["name", "f"], ["updated_at", Tue, 10 Dec 2013 11:51:38 UTC +00:00]]
|
150
|
-
[1m[36m (58.7ms)[0m [1mcommit transaction[0m
|
11
|
+
[1m[35mSQL (87.6ms)[0m INSERT INTO "users" ("created_at", "gender", "name", "updated_at") VALUES (?, ?, ?, ?) [["created_at", Mon, 30 Jun 2014 22:05:57 UTC +00:00], ["gender", "f"], ["name", "f"], ["updated_at", Mon, 30 Jun 2014 22:05:57 UTC +00:00]]
|
12
|
+
[1m[36m (2.5ms)[0m [1mcommit transaction[0m
|
151
13
|
[1m[35mUser Load (0.2ms)[0m SELECT "users".* FROM "users" ORDER BY "users"."id" DESC LIMIT 1
|
152
|
-
Started GET "/users" for 127.0.0.1 at 2013-12-10 11:51:38 +0000
|
153
|
-
Processing by UsersController#index as HTML
|
154
|
-
[1m[36mUser Load (0.1ms)[0m [1mSELECT "users".* FROM "users"[0m
|
155
|
-
Completed 200 OK in 8ms (Views: 7.4ms | ActiveRecord: 0.1ms)
|
156
|
-
Rendered users/_form.html.erb (5.5ms)
|
157
|
-
Rendered users/_form.html.erb (1.6ms)
|
158
|
-
WARNING: Can't mass-assign protected attributes for User: new
|
159
|
-
|
160
14
|
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
161
|
-
[1m[35mSQL (
|
162
|
-
|
163
|
-
[1m[
|
164
|
-
WARNING: Can't mass-assign protected attributes for User: new
|
165
|
-
|
166
|
-
[1m[35m (0.1ms)[0m begin transaction
|
167
|
-
[1m[36mSQL (0.2ms)[0m [1mINSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?)[0m [["created_at", Tue, 10 Dec 2013 11:52:11 UTC +00:00], ["updated_at", Tue, 10 Dec 2013 11:52:11 UTC +00:00]]
|
168
|
-
SQLite3::ConstraintException: users.name may not be NULL: INSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?)
|
169
|
-
[1m[35m (0.0ms)[0m rollback transaction
|
170
|
-
Processing by UsersController#new as HTML
|
171
|
-
Completed 200 OK in 5ms (Views: 4.9ms | ActiveRecord: 0.0ms)
|
172
|
-
WARNING: Can't mass-assign protected attributes for User: new
|
173
|
-
|
174
|
-
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
175
|
-
[1m[35mSQL (0.3ms)[0m INSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?) [["created_at", Tue, 10 Dec 2013 11:52:11 UTC +00:00], ["updated_at", Tue, 10 Dec 2013 11:52:11 UTC +00:00]]
|
176
|
-
SQLite3::ConstraintException: users.name may not be NULL: INSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?)
|
177
|
-
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
178
|
-
[1m[35m (0.2ms)[0m SELECT COUNT(*) FROM "users"
|
179
|
-
Processing by UsersController#create as HTML
|
180
|
-
Parameters: {"user"=>{"new"=>"MyString"}}
|
181
|
-
WARNING: Can't mass-assign protected attributes for User: new
|
182
|
-
app/controllers/users_controller.rb:43:in `create'
|
15
|
+
[1m[35mSQL (3.3ms)[0m INSERT INTO "users" ("created_at", "gender", "name", "updated_at") VALUES (?, ?, ?, ?) [["created_at", Mon, 30 Jun 2014 22:08:19 UTC +00:00], ["gender", "f"], ["name", "f"], ["updated_at", Mon, 30 Jun 2014 22:08:19 UTC +00:00]]
|
16
|
+
[1m[36m (53.4ms)[0m [1mcommit transaction[0m
|
17
|
+
[1m[35mUser Load (0.2ms)[0m SELECT "users".* FROM "users" ORDER BY "users"."id" DESC LIMIT 1
|
183
18
|
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
184
|
-
[1m[35mSQL (
|
185
|
-
|
186
|
-
[1m[
|
187
|
-
Completed 500 Internal Server Error in 3ms
|
188
|
-
Processing by UsersController#create as HTML
|
189
|
-
Parameters: {"user"=>{"new"=>"MyString"}}
|
190
|
-
WARNING: Can't mass-assign protected attributes for User: new
|
191
|
-
app/controllers/users_controller.rb:43:in `create'
|
192
|
-
[1m[35m (0.1ms)[0m begin transaction
|
193
|
-
[1m[36mSQL (0.3ms)[0m [1mINSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?)[0m [["created_at", Tue, 10 Dec 2013 11:52:11 UTC +00:00], ["updated_at", Tue, 10 Dec 2013 11:52:11 UTC +00:00]]
|
194
|
-
SQLite3::ConstraintException: users.name may not be NULL: INSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?)
|
195
|
-
[1m[35m (0.1ms)[0m rollback transaction
|
196
|
-
Completed 500 Internal Server Error in 3ms
|
197
|
-
Processing by UsersController#create as HTML
|
198
|
-
Parameters: {"user"=>{"new"=>"MyString"}}
|
199
|
-
WARNING: Can't mass-assign protected attributes for User: new
|
200
|
-
app/controllers/users_controller.rb:43:in `create'
|
19
|
+
[1m[35mSQL (2.3ms)[0m INSERT INTO "users" ("created_at", "gender", "name", "updated_at") VALUES (?, ?, ?, ?) [["created_at", Mon, 30 Jun 2014 22:08:51 UTC +00:00], ["gender", "f"], ["name", "f"], ["updated_at", Mon, 30 Jun 2014 22:08:51 UTC +00:00]]
|
20
|
+
[1m[36m (51.2ms)[0m [1mcommit transaction[0m
|
21
|
+
[1m[35mUser Load (0.2ms)[0m SELECT "users".* FROM "users" ORDER BY "users"."id" DESC LIMIT 1
|
201
22
|
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
202
|
-
[1m[35mSQL (
|
203
|
-
|
204
|
-
[1m[
|
205
|
-
Completed 500 Internal Server Error in 3ms
|
206
|
-
Processing by UsersController#create as HTML
|
207
|
-
Parameters: {"user"=>{"new"=>"invalid value"}}
|
208
|
-
WARNING: Can't mass-assign protected attributes for User: new
|
209
|
-
app/controllers/users_controller.rb:43:in `create'
|
210
|
-
Completed 200 OK in 3ms (Views: 0.6ms | ActiveRecord: 0.0ms)
|
211
|
-
Processing by UsersController#create as HTML
|
212
|
-
Parameters: {"user"=>{"new"=>"invalid value"}}
|
213
|
-
WARNING: Can't mass-assign protected attributes for User: new
|
214
|
-
app/controllers/users_controller.rb:43:in `create'
|
215
|
-
Completed 200 OK in 2ms (Views: 0.5ms | ActiveRecord: 0.0ms)
|
216
|
-
WARNING: Can't mass-assign protected attributes for User: new
|
217
|
-
|
218
|
-
[1m[35m (0.1ms)[0m begin transaction
|
219
|
-
[1m[36mSQL (0.3ms)[0m [1mINSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?)[0m [["created_at", Tue, 10 Dec 2013 11:52:11 UTC +00:00], ["updated_at", Tue, 10 Dec 2013 11:52:11 UTC +00:00]]
|
220
|
-
SQLite3::ConstraintException: users.name may not be NULL: INSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?)
|
221
|
-
[1m[35m (0.0ms)[0m rollback transaction
|
222
|
-
WARNING: Can't mass-assign protected attributes for User: new
|
223
|
-
|
23
|
+
[1m[35mSQL (2.4ms)[0m INSERT INTO "users" ("created_at", "gender", "name", "updated_at") VALUES (?, ?, ?, ?) [["created_at", Mon, 30 Jun 2014 22:09:03 UTC +00:00], ["gender", "f"], ["name", "f"], ["updated_at", Mon, 30 Jun 2014 22:09:03 UTC +00:00]]
|
24
|
+
[1m[36m (2.7ms)[0m [1mcommit transaction[0m
|
25
|
+
[1m[35mUser Load (0.2ms)[0m SELECT "users".* FROM "users" ORDER BY "users"."id" DESC LIMIT 1
|
224
26
|
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
225
|
-
[1m[35mSQL (
|
226
|
-
|
227
|
-
[1m[
|
228
|
-
WARNING: Can't mass-assign protected attributes for User: new
|
229
|
-
|
230
|
-
[1m[35m (0.1ms)[0m begin transaction
|
231
|
-
[1m[36mSQL (0.2ms)[0m [1mINSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?)[0m [["created_at", Tue, 10 Dec 2013 11:52:11 UTC +00:00], ["updated_at", Tue, 10 Dec 2013 11:52:11 UTC +00:00]]
|
232
|
-
SQLite3::ConstraintException: users.name may not be NULL: INSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?)
|
233
|
-
[1m[35m (0.0ms)[0m rollback transaction
|
234
|
-
WARNING: Can't mass-assign protected attributes for User: new
|
235
|
-
|
27
|
+
[1m[35mSQL (2.3ms)[0m INSERT INTO "users" ("created_at", "gender", "name", "updated_at") VALUES (?, ?, ?, ?) [["created_at", Mon, 30 Jun 2014 22:10:54 UTC +00:00], ["gender", "f"], ["name", "f"], ["updated_at", Mon, 30 Jun 2014 22:10:54 UTC +00:00]]
|
28
|
+
[1m[36m (51.3ms)[0m [1mcommit transaction[0m
|
29
|
+
[1m[35mUser Load (0.2ms)[0m SELECT "users".* FROM "users" ORDER BY "users"."id" DESC LIMIT 1
|
236
30
|
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
237
|
-
[1m[35mSQL (
|
238
|
-
|
239
|
-
[1m[
|
240
|
-
WARNING: Can't mass-assign protected attributes for User: new
|
241
|
-
|
242
|
-
[1m[35m (0.1ms)[0m begin transaction
|
243
|
-
[1m[36mSQL (0.2ms)[0m [1mINSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?)[0m [["created_at", Tue, 10 Dec 2013 11:52:11 UTC +00:00], ["updated_at", Tue, 10 Dec 2013 11:52:11 UTC +00:00]]
|
244
|
-
SQLite3::ConstraintException: users.name may not be NULL: INSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?)
|
245
|
-
[1m[35m (0.0ms)[0m rollback transaction
|
246
|
-
WARNING: Can't mass-assign protected attributes for User: new
|
247
|
-
|
31
|
+
[1m[35mSQL (3.2ms)[0m INSERT INTO "users" ("created_at", "gender", "name", "updated_at") VALUES (?, ?, ?, ?) [["created_at", Mon, 30 Jun 2014 22:11:20 UTC +00:00], ["gender", "f"], ["name", "f"], ["updated_at", Mon, 30 Jun 2014 22:11:20 UTC +00:00]]
|
32
|
+
[1m[36m (2.4ms)[0m [1mcommit transaction[0m
|
33
|
+
[1m[35mUser Load (0.2ms)[0m SELECT "users".* FROM "users" ORDER BY "users"."id" DESC LIMIT 1
|
248
34
|
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
249
|
-
[1m[35mSQL (
|
250
|
-
|
251
|
-
[1m[
|
252
|
-
WARNING: Can't mass-assign protected attributes for User: new
|
253
|
-
|
254
|
-
[1m[35m (0.1ms)[0m begin transaction
|
255
|
-
[1m[36mSQL (0.2ms)[0m [1mINSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?)[0m [["created_at", Tue, 10 Dec 2013 11:52:11 UTC +00:00], ["updated_at", Tue, 10 Dec 2013 11:52:11 UTC +00:00]]
|
256
|
-
SQLite3::ConstraintException: users.name may not be NULL: INSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?)
|
257
|
-
[1m[35m (0.1ms)[0m rollback transaction
|
35
|
+
[1m[35mSQL (2.3ms)[0m INSERT INTO "users" ("created_at", "gender", "name", "updated_at") VALUES (?, ?, ?, ?) [["created_at", Mon, 30 Jun 2014 22:11:42 UTC +00:00], ["gender", "f"], ["name", "f"], ["updated_at", Mon, 30 Jun 2014 22:11:42 UTC +00:00]]
|
36
|
+
[1m[36m (122.6ms)[0m [1mcommit transaction[0m
|
37
|
+
[1m[35mUser Load (0.4ms)[0m SELECT "users".* FROM "users" ORDER BY "users"."id" DESC LIMIT 1
|
258
38
|
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
259
|
-
[1m[35mSQL (
|
260
|
-
[1m[36m (
|
261
|
-
[1m[35mUser Load (0.
|
262
|
-
Started GET "/users" for 127.0.0.1 at 2013-12-10 11:52:11 +0000
|
263
|
-
Processing by UsersController#index as HTML
|
264
|
-
[1m[36mUser Load (0.2ms)[0m [1mSELECT "users".* FROM "users"[0m
|
265
|
-
Completed 200 OK in 8ms (Views: 7.5ms | ActiveRecord: 0.2ms)
|
266
|
-
Rendered users/_form.html.erb (4.8ms)
|
267
|
-
Rendered users/_form.html.erb (1.8ms)
|
39
|
+
[1m[35mSQL (2.4ms)[0m INSERT INTO "users" ("created_at", "gender", "name", "updated_at") VALUES (?, ?, ?, ?) [["created_at", Mon, 30 Jun 2014 22:12:53 UTC +00:00], ["gender", "f"], ["name", "f"], ["updated_at", Mon, 30 Jun 2014 22:12:53 UTC +00:00]]
|
40
|
+
[1m[36m (2.5ms)[0m [1mcommit transaction[0m
|
41
|
+
[1m[35mUser Load (0.2ms)[0m SELECT "users".* FROM "users" ORDER BY "users"."id" DESC LIMIT 1
|
268
42
|
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
269
|
-
[1m[35mSQL (2.
|
270
|
-
[1m[36m (
|
43
|
+
[1m[35mSQL (2.3ms)[0m INSERT INTO "users" ("created_at", "gender", "name", "updated_at") VALUES (?, ?, ?, ?) [["created_at", Mon, 30 Jun 2014 22:13:48 UTC +00:00], ["gender", "f"], ["name", "f"], ["updated_at", Mon, 30 Jun 2014 22:13:48 UTC +00:00]]
|
44
|
+
[1m[36m (54.8ms)[0m [1mcommit transaction[0m
|
271
45
|
[1m[35mUser Load (0.2ms)[0m SELECT "users".* FROM "users" ORDER BY "users"."id" DESC LIMIT 1
|
@@ -21,6 +21,14 @@ describe User do
|
|
21
21
|
|
22
22
|
end
|
23
23
|
|
24
|
+
describe "full gender names" do
|
25
|
+
|
26
|
+
it 'should set the gender as the abbreviation' do
|
27
|
+
User.new(gender: "female").gender.should be_female
|
28
|
+
User.new(gender: "male").gender.should be_male
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
24
32
|
# Since the db column name can be changed, we're using the "name" column to
|
25
33
|
# test this behaviour
|
26
34
|
describe "name" do
|
data/spec/lib/gender_spec.rb
CHANGED
@@ -6,6 +6,16 @@ describe Genderize::Gender do
|
|
6
6
|
let(:male) { Gender.new("M") }
|
7
7
|
let(:blank) { Gender.new('') }
|
8
8
|
|
9
|
+
context "when full gender name is used" do
|
10
|
+
|
11
|
+
it "should find the correct abbreviation" do
|
12
|
+
Gender.new("female").abbr.should eql('f')
|
13
|
+
Gender.new("male").abbr.should eql('m')
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
|
18
|
+
|
9
19
|
describe :name do
|
10
20
|
|
11
21
|
context "when male" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: genderize
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bodacious
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-06-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -101,6 +101,7 @@ files:
|
|
101
101
|
- spec/dummy/db/migrate/20130506080641_create_users.rb
|
102
102
|
- spec/dummy/db/schema.rb
|
103
103
|
- spec/dummy/db/test.sqlite3
|
104
|
+
- spec/dummy/log/development.log
|
104
105
|
- spec/dummy/log/test.log
|
105
106
|
- spec/dummy/Rakefile
|
106
107
|
- spec/dummy/README.rdoc
|
@@ -162,6 +163,7 @@ test_files:
|
|
162
163
|
- spec/dummy/db/migrate/20130506080641_create_users.rb
|
163
164
|
- spec/dummy/db/schema.rb
|
164
165
|
- spec/dummy/db/test.sqlite3
|
166
|
+
- spec/dummy/log/development.log
|
165
167
|
- spec/dummy/log/test.log
|
166
168
|
- spec/dummy/Rakefile
|
167
169
|
- spec/dummy/README.rdoc
|