genderize 0.0.5 → 0.0.6

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: d13b5523ca109aff691a9d5565abf7bfde321b92
4
- data.tar.gz: f7e9c526394deec2340064657182c0cbb0b6ea55
3
+ metadata.gz: fb0f9371760b224246e156a4c38f010df1e7e56a
4
+ data.tar.gz: f9a43ab985038479e2b1ec4eb712db849004d845
5
5
  SHA512:
6
- metadata.gz: 9c57723ffbf6167a98254bfe0322f76f8fdf228e257bb5a9c2986d29d49552d23d0a0515e3ea4088ac4d4d2e6e1576bf0e44e1d0ed777a02737e28f6396addf8
7
- data.tar.gz: c99c74f731f9d8cfe52e2b22fb687fb297619274c496f080788d7fe07a757bb3769dd27d977003912805403fac07c330136d094da68302570b8df029504c3b3a
6
+ metadata.gz: 463b88c489a86cdabf90ae3eb3f9b818e3b8177cda066ce1cf5b56f3332fec2fa5e9b41b8c7ff9e07268bf8a074be9390c7349d08bab4e8c45427a08316f5318
7
+ data.tar.gz: 0bb8dcf6ba581f3436afa2b8fbed28a49018a7e242d895151e50732128e018e17f6b5e5e1a77e924477546df2ff143197140cff9ca9508a2020ac80594fdc525
@@ -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
- unless string.blank? or string.to_s =~ /\A(m|f)\Z/i
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)
@@ -6,8 +6,10 @@ module Genderize
6
6
  attr_reader :abbr
7
7
 
8
8
  def initialize(abbr)
9
- raise "Invalid abbreviation: '#{abbr}'" unless abbr.blank? or abbr.to_s =~ /\A(f|m)\Z/i
10
- @abbr = abbr.blank? ? nil : abbr.to_s.downcase
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
@@ -1,3 +1,3 @@
1
1
  module Genderize
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
Binary file
@@ -0,0 +1,11 @@
1
+  (2.5ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
2
+  (3.2ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
3
+ ActiveRecord::SchemaMigration Load (0.2ms) SELECT "schema_migrations".* FROM "schema_migrations"
4
+ Migrating to CreateUsers (20130506080641)
5
+  (0.1ms) begin transaction
6
+  (0.4ms) CREATE 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) 
7
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20130506080641"]]
8
+  (3.5ms) commit transaction
9
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
10
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
11
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
@@ -1,271 +1,45 @@
1
- Processing by UsersController#new as HTML
2
- Completed 500 Internal Server Error in 0ms
3
- Processing by UsersController#create as HTML
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
- User Load (0.3ms) SELECT "users".* FROM "users"
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
- User Load (0.3ms) SELECT "users".* FROM "users"
37
- SQLite3::SQLException: no such table: users: SELECT "users".* FROM "users"
38
- Completed 500 Internal Server Error in 8ms
39
-  (55.2ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
40
-  (3.7ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
41
- ActiveRecord::SchemaMigration Load (0.2ms) SELECT "schema_migrations".* FROM "schema_migrations"
1
+  (54.5ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
2
+  (2.4ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
3
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
42
4
  Migrating to CreateUsers (20130506080641)
43
5
   (0.1ms) begin transaction
44
6
   (0.5ms) CREATE 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) 
45
7
  SQL (0.3ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20130506080641"]]
46
-  (2.8ms) commit transaction
8
+  (3.0ms) commit transaction
47
9
  ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
48
- WARNING: Can't mass-assign protected attributes for User: new
49
-
50
10
   (0.1ms) begin transaction
51
- SQL (2.1ms) 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]]
52
- SQLite3::ConstraintException: users.name may not be NULL: INSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?)
53
-  (0.1ms) rollback transaction
54
- WARNING: Can't mass-assign protected attributes for User: new
55
-
56
-  (0.1ms) begin transaction
57
- SQL (0.3ms) 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]]
58
- SQLite3::ConstraintException: users.name may not be NULL: INSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?)
59
-  (0.0ms) 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
-  (0.1ms) begin transaction
65
- SQL (0.3ms) 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
-  (0.0ms) rollback transaction
68
-  (0.1ms) 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
-  (0.1ms) begin transaction
74
- SQL (0.9ms) 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
-  (0.1ms) rollback transaction
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
-  (0.1ms) begin transaction
83
- SQL (0.3ms) 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]]
84
- SQLite3::ConstraintException: users.name may not be NULL: INSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?)
85
-  (0.1ms) 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
-  (0.1ms) begin transaction
92
- SQL (0.3ms) 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
-  (0.0ms) rollback transaction
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
-  (0.1ms) begin transaction
109
- SQL (0.3ms) 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]]
110
- SQLite3::ConstraintException: users.name may not be NULL: INSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?)
111
-  (0.0ms) rollback transaction
112
- WARNING: Can't mass-assign protected attributes for User: new
113
-
114
-  (0.1ms) begin transaction
115
- SQL (0.3ms) 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
-  (0.1ms) rollback transaction
118
- WARNING: Can't mass-assign protected attributes for User: new
119
-
120
-  (0.1ms) begin transaction
121
- SQL (0.3ms) 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]]
122
- SQLite3::ConstraintException: users.name may not be NULL: INSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?)
123
-  (0.1ms) rollback transaction
124
- WARNING: Can't mass-assign protected attributes for User: new
125
-
126
-  (0.1ms) begin transaction
127
- SQL (0.3ms) 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
-  (0.0ms) rollback transaction
130
- WARNING: Can't mass-assign protected attributes for User: new
131
-
132
-  (0.0ms) begin transaction
133
- SQL (0.2ms) 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]]
134
- SQLite3::ConstraintException: users.name may not be NULL: INSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?)
135
-  (0.0ms) rollback transaction
136
- WARNING: Can't mass-assign protected attributes for User: new
137
-
138
-  (0.1ms) begin transaction
139
- SQL (0.3ms) 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
-  (0.0ms) rollback transaction
142
- WARNING: Can't mass-assign protected attributes for User: new
143
-
144
-  (0.1ms) begin transaction
145
- SQL (0.2ms) 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]]
146
- SQLite3::ConstraintException: users.name may not be NULL: INSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?)
147
-  (0.0ms) rollback transaction
148
-  (0.1ms) begin transaction
149
- SQL (0.4ms) 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
-  (58.7ms) commit transaction
11
+ SQL (87.6ms) 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
+  (2.5ms) commit transaction
151
13
  User Load (0.2ms) 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
- User Load (0.1ms) SELECT "users".* FROM "users"
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
   (0.1ms) begin transaction
161
- SQL (2.0ms) 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]]
162
- SQLite3::ConstraintException: users.name may not be NULL: INSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?)
163
-  (0.1ms) rollback transaction
164
- WARNING: Can't mass-assign protected attributes for User: new
165
-
166
-  (0.1ms) begin transaction
167
- SQL (0.2ms) 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]]
168
- SQLite3::ConstraintException: users.name may not be NULL: INSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?)
169
-  (0.0ms) 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
-  (0.1ms) begin transaction
175
- SQL (0.3ms) 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
-  (0.1ms) rollback transaction
178
-  (0.2ms) 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
+ SQL (3.3ms) 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
+  (53.4ms) commit transaction
17
+ User Load (0.2ms) SELECT "users".* FROM "users" ORDER BY "users"."id" DESC LIMIT 1
183
18
   (0.1ms) begin transaction
184
- SQL (0.4ms) 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]]
185
- SQLite3::ConstraintException: users.name may not be NULL: INSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?)
186
-  (0.1ms) rollback transaction
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
-  (0.1ms) begin transaction
193
- SQL (0.3ms) 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]]
194
- SQLite3::ConstraintException: users.name may not be NULL: INSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?)
195
-  (0.1ms) 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
+ SQL (2.3ms) 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
+  (51.2ms) commit transaction
21
+ User Load (0.2ms) SELECT "users".* FROM "users" ORDER BY "users"."id" DESC LIMIT 1
201
22
   (0.1ms) begin transaction
202
- SQL (0.3ms) 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]]
203
- SQLite3::ConstraintException: users.name may not be NULL: INSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?)
204
-  (0.1ms) rollback transaction
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
-  (0.1ms) begin transaction
219
- SQL (0.3ms) 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]]
220
- SQLite3::ConstraintException: users.name may not be NULL: INSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?)
221
-  (0.0ms) rollback transaction
222
- WARNING: Can't mass-assign protected attributes for User: new
223
-
23
+ SQL (2.4ms) 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
+  (2.7ms) commit transaction
25
+ User Load (0.2ms) SELECT "users".* FROM "users" ORDER BY "users"."id" DESC LIMIT 1
224
26
   (0.1ms) begin transaction
225
- SQL (0.3ms) 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]]
226
- SQLite3::ConstraintException: users.name may not be NULL: INSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?)
227
-  (0.0ms) rollback transaction
228
- WARNING: Can't mass-assign protected attributes for User: new
229
-
230
-  (0.1ms) begin transaction
231
- SQL (0.2ms) 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]]
232
- SQLite3::ConstraintException: users.name may not be NULL: INSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?)
233
-  (0.0ms) rollback transaction
234
- WARNING: Can't mass-assign protected attributes for User: new
235
-
27
+ SQL (2.3ms) 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
+  (51.3ms) commit transaction
29
+ User Load (0.2ms) SELECT "users".* FROM "users" ORDER BY "users"."id" DESC LIMIT 1
236
30
   (0.1ms) begin transaction
237
- SQL (0.2ms) 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]]
238
- SQLite3::ConstraintException: users.name may not be NULL: INSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?)
239
-  (0.0ms) rollback transaction
240
- WARNING: Can't mass-assign protected attributes for User: new
241
-
242
-  (0.1ms) begin transaction
243
- SQL (0.2ms) 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]]
244
- SQLite3::ConstraintException: users.name may not be NULL: INSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?)
245
-  (0.0ms) rollback transaction
246
- WARNING: Can't mass-assign protected attributes for User: new
247
-
31
+ SQL (3.2ms) 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
+  (2.4ms) commit transaction
33
+ User Load (0.2ms) SELECT "users".* FROM "users" ORDER BY "users"."id" DESC LIMIT 1
248
34
   (0.1ms) begin transaction
249
- SQL (0.3ms) 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]]
250
- SQLite3::ConstraintException: users.name may not be NULL: INSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?)
251
-  (0.1ms) rollback transaction
252
- WARNING: Can't mass-assign protected attributes for User: new
253
-
254
-  (0.1ms) begin transaction
255
- SQL (0.2ms) 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]]
256
- SQLite3::ConstraintException: users.name may not be NULL: INSERT INTO "users" ("created_at", "updated_at") VALUES (?, ?)
257
-  (0.1ms) rollback transaction
35
+ SQL (2.3ms) 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
+  (122.6ms) commit transaction
37
+ User Load (0.4ms) SELECT "users".* FROM "users" ORDER BY "users"."id" DESC LIMIT 1
258
38
   (0.1ms) begin transaction
259
- SQL (0.5ms) INSERT INTO "users" ("created_at", "gender", "name", "updated_at") VALUES (?, ?, ?, ?) [["created_at", Tue, 10 Dec 2013 11:52:11 UTC +00:00], ["gender", "f"], ["name", "f"], ["updated_at", Tue, 10 Dec 2013 11:52:11 UTC +00:00]]
260
-  (58.0ms) commit transaction
261
- User Load (0.3ms) SELECT "users".* FROM "users" ORDER BY "users"."id" DESC LIMIT 1
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
- User Load (0.2ms) SELECT "users".* FROM "users"
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
+ SQL (2.4ms) 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
+  (2.5ms) commit transaction
41
+ User Load (0.2ms) SELECT "users".* FROM "users" ORDER BY "users"."id" DESC LIMIT 1
268
42
   (0.1ms) begin transaction
269
- SQL (2.2ms) INSERT INTO "users" ("created_at", "gender", "name", "updated_at") VALUES (?, ?, ?, ?) [["created_at", Tue, 10 Dec 2013 11:54:20 UTC +00:00], ["gender", "f"], ["name", "f"], ["updated_at", Tue, 10 Dec 2013 11:54:20 UTC +00:00]]
270
-  (53.6ms) commit transaction
43
+ SQL (2.3ms) 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
+  (54.8ms) commit transaction
271
45
  User Load (0.2ms) 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
@@ -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.5
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: 2013-12-10 00:00:00.000000000 Z
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