formtastic 3.0.0 → 3.1.0.rc1

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.
Files changed (49) hide show
  1. data/.travis.yml +1 -0
  2. data/Appraisals +4 -0
  3. data/CHANGELOG +12 -22
  4. data/DEPRECATIONS +47 -0
  5. data/README.textile +9 -4
  6. data/formtastic.gemspec +3 -3
  7. data/gemfiles/rails_4.2.gemfile +7 -0
  8. data/lib/formtastic.rb +13 -7
  9. data/lib/formtastic/action_class_finder.rb +18 -0
  10. data/lib/formtastic/deprecation.rb +42 -0
  11. data/lib/formtastic/form_builder.rb +12 -6
  12. data/lib/formtastic/helpers/action_helper.rb +43 -6
  13. data/lib/formtastic/helpers/form_helper.rb +2 -2
  14. data/lib/formtastic/helpers/input_helper.rb +71 -31
  15. data/lib/formtastic/html_attributes.rb +12 -1
  16. data/lib/formtastic/input_class_finder.rb +18 -0
  17. data/lib/formtastic/inputs.rb +1 -0
  18. data/lib/formtastic/inputs/base.rb +11 -12
  19. data/lib/formtastic/inputs/base/choices.rb +1 -1
  20. data/lib/formtastic/inputs/base/collections.rb +1 -1
  21. data/lib/formtastic/inputs/base/html.rb +3 -3
  22. data/lib/formtastic/inputs/datalist_input.rb +41 -0
  23. data/lib/formtastic/inputs/file_input.rb +2 -2
  24. data/lib/formtastic/namespaced_class_finder.rb +89 -0
  25. data/lib/formtastic/util.rb +1 -1
  26. data/lib/formtastic/version.rb +1 -1
  27. data/lib/generators/templates/formtastic.rb +20 -0
  28. data/spec/action_class_finder_spec.rb +12 -0
  29. data/spec/builder/custom_builder_spec.rb +2 -2
  30. data/spec/builder/semantic_fields_for_spec.rb +4 -4
  31. data/spec/helpers/action_helper_spec.rb +9 -355
  32. data/spec/helpers/form_helper_spec.rb +11 -1
  33. data/spec/helpers/input_helper_spec.rb +1 -916
  34. data/spec/helpers/namespaced_action_helper_spec.rb +43 -0
  35. data/spec/helpers/namespaced_input_helper_spec.rb +36 -0
  36. data/spec/input_class_finder_spec.rb +10 -0
  37. data/spec/inputs/check_boxes_input_spec.rb +2 -2
  38. data/spec/inputs/datalist_input_spec.rb +61 -0
  39. data/spec/inputs/select_input_spec.rb +1 -1
  40. data/spec/localizer_spec.rb +2 -2
  41. data/spec/namespaced_class_finder_spec.rb +79 -0
  42. data/spec/spec_helper.rb +17 -7
  43. data/spec/support/custom_macros.rb +22 -4
  44. data/spec/support/shared_examples.rb +1244 -0
  45. data/spec/support/specialized_class_finder_shared_example.rb +27 -0
  46. data/spec/support/test_environment.rb +1 -1
  47. data/spec/util_spec.rb +20 -6
  48. metadata +66 -15
  49. checksums.yaml +0 -15
@@ -0,0 +1,27 @@
1
+ # encoding: utf-8
2
+ #
3
+ RSpec.shared_examples 'Specialized Class Finder' do
4
+ let(:builder) { Formtastic::FormBuilder.allocate }
5
+ subject(:finder) { described_class.new(builder) }
6
+
7
+ context 'by default' do
8
+ it 'includes Object and the default namespaces' do
9
+ expect(finder.namespaces).to eq([Object, default])
10
+ end
11
+ end
12
+
13
+ context 'with namespace configuration set to a custom list of modules' do
14
+ before do
15
+ stub_const('CustomModule', Module.new)
16
+ stub_const('AnotherModule', Module.new)
17
+
18
+ allow(Formtastic::FormBuilder).to receive(namespaces_setting)
19
+ .and_return([ CustomModule, AnotherModule ])
20
+ end
21
+
22
+ it 'includes just the custom namespaces' do
23
+ expect(finder.namespaces).to eq([CustomModule, AnotherModule])
24
+ end
25
+ end
26
+
27
+ end
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- require 'rspec'
2
+ require 'rspec/core'
3
3
  require 'rspec_tag_matchers'
4
4
 
5
5
  RSpec.configure do |config|
@@ -10,42 +10,56 @@ describe 'Formtastic::Util' do
10
10
  context '4.0.0' do
11
11
  before { allow(Formtastic::Util).to receive(:rails_version) { Gem::Version.new("4.0.0") } }
12
12
  it 'should be true' do
13
- expect(subject).to be_true
13
+ expect(subject).to be_truthy
14
14
  end
15
15
  end
16
16
 
17
17
  context '4.0.3' do
18
18
  before { allow(Formtastic::Util).to receive(:rails_version) { Gem::Version.new("4.0.3") } }
19
19
  it 'should be true' do
20
- expect(subject).to be_true
20
+ expect(subject).to be_truthy
21
21
  end
22
22
  end
23
23
 
24
24
  context '4.0.4' do
25
25
  before { allow(Formtastic::Util).to receive(:rails_version) { Gem::Version.new("4.0.4") } }
26
26
  it 'should be false' do
27
- expect(subject).to be_false
27
+ expect(subject).to be_truthy
28
28
  end
29
29
  end
30
30
 
31
31
  context '4.0.5' do
32
32
  before { allow(Formtastic::Util).to receive(:rails_version) { Gem::Version.new("4.0.5") } }
33
33
  it 'should be false' do
34
- expect(subject).to be_false
34
+ expect(subject).to be_truthy
35
+ end
36
+ end
37
+
38
+ context '4.1.0' do
39
+ before { allow(Formtastic::Util).to receive(:rails_version) { Gem::Version.new("4.1.1") } }
40
+ it 'should be false' do
41
+ expect(subject).to be_falsey
35
42
  end
36
43
  end
37
44
 
38
45
  context '4.1.1' do
39
46
  before { allow(Formtastic::Util).to receive(:rails_version) { Gem::Version.new("4.1.1") } }
40
47
  it 'should be false' do
41
- expect(subject).to be_false
48
+ expect(subject).to be_falsey
49
+ end
50
+ end
51
+
52
+ context '4.2.0' do
53
+ before { allow(Formtastic::Util).to receive(:rails_version) { Gem::Version.new("4.1.1") } }
54
+ it 'should be false' do
55
+ expect(subject).to be_falsey
42
56
  end
43
57
  end
44
58
 
45
59
  context '5.0.0' do
46
60
  before { allow(Formtastic::Util).to receive(:rails_version) { Gem::Version.new("5.0.0") } }
47
61
  it 'should be true' do
48
- expect(subject).to be_false
62
+ expect(subject).to be_falsey
49
63
  end
50
64
  end
51
65
  end
metadata CHANGED
@@ -1,18 +1,20 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: formtastic
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.1.0.rc1
5
+ prerelease: 6
5
6
  platform: ruby
6
7
  authors:
7
8
  - Justin French
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2014-09-06 00:00:00.000000000 Z
12
+ date: 2014-11-04 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: actionpack
15
16
  requirement: !ruby/object:Gem::Requirement
17
+ none: false
16
18
  requirements:
17
19
  - - ! '>='
18
20
  - !ruby/object:Gem::Version
@@ -20,6 +22,7 @@ dependencies:
20
22
  type: :runtime
21
23
  prerelease: false
22
24
  version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
23
26
  requirements:
24
27
  - - ! '>='
25
28
  - !ruby/object:Gem::Version
@@ -27,20 +30,23 @@ dependencies:
27
30
  - !ruby/object:Gem::Dependency
28
31
  name: nokogiri
29
32
  requirement: !ruby/object:Gem::Requirement
33
+ none: false
30
34
  requirements:
31
- - - <
35
+ - - ! '>='
32
36
  - !ruby/object:Gem::Version
33
- version: 1.6.0
37
+ version: '0'
34
38
  type: :development
35
39
  prerelease: false
36
40
  version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
37
42
  requirements:
38
- - - <
43
+ - - ! '>='
39
44
  - !ruby/object:Gem::Version
40
- version: 1.6.0
45
+ version: '0'
41
46
  - !ruby/object:Gem::Dependency
42
47
  name: rspec-rails
43
48
  requirement: !ruby/object:Gem::Requirement
49
+ none: false
44
50
  requirements:
45
51
  - - ~>
46
52
  - !ruby/object:Gem::Version
@@ -48,6 +54,7 @@ dependencies:
48
54
  type: :development
49
55
  prerelease: false
50
56
  version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
51
58
  requirements:
52
59
  - - ~>
53
60
  - !ruby/object:Gem::Version
@@ -55,6 +62,7 @@ dependencies:
55
62
  - !ruby/object:Gem::Dependency
56
63
  name: rspec_tag_matchers
57
64
  requirement: !ruby/object:Gem::Requirement
65
+ none: false
58
66
  requirements:
59
67
  - - ~>
60
68
  - !ruby/object:Gem::Version
@@ -62,6 +70,7 @@ dependencies:
62
70
  type: :development
63
71
  prerelease: false
64
72
  version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
65
74
  requirements:
66
75
  - - ~>
67
76
  - !ruby/object:Gem::Version
@@ -69,6 +78,7 @@ dependencies:
69
78
  - !ruby/object:Gem::Dependency
70
79
  name: hpricot
71
80
  requirement: !ruby/object:Gem::Requirement
81
+ none: false
72
82
  requirements:
73
83
  - - ~>
74
84
  - !ruby/object:Gem::Version
@@ -76,6 +86,7 @@ dependencies:
76
86
  type: :development
77
87
  prerelease: false
78
88
  version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
79
90
  requirements:
80
91
  - - ~>
81
92
  - !ruby/object:Gem::Version
@@ -83,6 +94,7 @@ dependencies:
83
94
  - !ruby/object:Gem::Dependency
84
95
  name: BlueCloth
85
96
  requirement: !ruby/object:Gem::Requirement
97
+ none: false
86
98
  requirements:
87
99
  - - ~>
88
100
  - !ruby/object:Gem::Version
@@ -90,6 +102,7 @@ dependencies:
90
102
  type: :development
91
103
  prerelease: false
92
104
  version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
93
106
  requirements:
94
107
  - - ~>
95
108
  - !ruby/object:Gem::Version
@@ -97,6 +110,7 @@ dependencies:
97
110
  - !ruby/object:Gem::Dependency
98
111
  name: yard
99
112
  requirement: !ruby/object:Gem::Requirement
113
+ none: false
100
114
  requirements:
101
115
  - - ~>
102
116
  - !ruby/object:Gem::Version
@@ -104,6 +118,7 @@ dependencies:
104
118
  type: :development
105
119
  prerelease: false
106
120
  version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
107
122
  requirements:
108
123
  - - ~>
109
124
  - !ruby/object:Gem::Version
@@ -111,6 +126,7 @@ dependencies:
111
126
  - !ruby/object:Gem::Dependency
112
127
  name: colored
113
128
  requirement: !ruby/object:Gem::Requirement
129
+ none: false
114
130
  requirements:
115
131
  - - ~>
116
132
  - !ruby/object:Gem::Version
@@ -118,6 +134,7 @@ dependencies:
118
134
  type: :development
119
135
  prerelease: false
120
136
  version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
121
138
  requirements:
122
139
  - - ~>
123
140
  - !ruby/object:Gem::Version
@@ -125,6 +142,7 @@ dependencies:
125
142
  - !ruby/object:Gem::Dependency
126
143
  name: tzinfo
127
144
  requirement: !ruby/object:Gem::Requirement
145
+ none: false
128
146
  requirements:
129
147
  - - ! '>='
130
148
  - !ruby/object:Gem::Version
@@ -132,6 +150,7 @@ dependencies:
132
150
  type: :development
133
151
  prerelease: false
134
152
  version_requirements: !ruby/object:Gem::Requirement
153
+ none: false
135
154
  requirements:
136
155
  - - ! '>='
137
156
  - !ruby/object:Gem::Version
@@ -139,20 +158,23 @@ dependencies:
139
158
  - !ruby/object:Gem::Dependency
140
159
  name: ammeter
141
160
  requirement: !ruby/object:Gem::Requirement
161
+ none: false
142
162
  requirements:
143
163
  - - '='
144
164
  - !ruby/object:Gem::Version
145
- version: 0.2.5
165
+ version: 1.1.1
146
166
  type: :development
147
167
  prerelease: false
148
168
  version_requirements: !ruby/object:Gem::Requirement
169
+ none: false
149
170
  requirements:
150
171
  - - '='
151
172
  - !ruby/object:Gem::Version
152
- version: 0.2.5
173
+ version: 1.1.1
153
174
  - !ruby/object:Gem::Dependency
154
175
  name: appraisal
155
176
  requirement: !ruby/object:Gem::Requirement
177
+ none: false
156
178
  requirements:
157
179
  - - ~>
158
180
  - !ruby/object:Gem::Version
@@ -160,6 +182,7 @@ dependencies:
160
182
  type: :development
161
183
  prerelease: false
162
184
  version_requirements: !ruby/object:Gem::Requirement
185
+ none: false
163
186
  requirements:
164
187
  - - ~>
165
188
  - !ruby/object:Gem::Version
@@ -167,20 +190,23 @@ dependencies:
167
190
  - !ruby/object:Gem::Dependency
168
191
  name: rake
169
192
  requirement: !ruby/object:Gem::Requirement
193
+ none: false
170
194
  requirements:
171
- - - <=
195
+ - - ! '>='
172
196
  - !ruby/object:Gem::Version
173
- version: 10.1.1
197
+ version: '0'
174
198
  type: :development
175
199
  prerelease: false
176
200
  version_requirements: !ruby/object:Gem::Requirement
201
+ none: false
177
202
  requirements:
178
- - - <=
203
+ - - ! '>='
179
204
  - !ruby/object:Gem::Version
180
- version: 10.1.1
205
+ version: '0'
181
206
  - !ruby/object:Gem::Dependency
182
207
  name: activemodel
183
208
  requirement: !ruby/object:Gem::Requirement
209
+ none: false
184
210
  requirements:
185
211
  - - ! '>='
186
212
  - !ruby/object:Gem::Version
@@ -188,6 +214,7 @@ dependencies:
188
214
  type: :development
189
215
  prerelease: false
190
216
  version_requirements: !ruby/object:Gem::Requirement
217
+ none: false
191
218
  requirements:
192
219
  - - ! '>='
193
220
  - !ruby/object:Gem::Version
@@ -207,6 +234,7 @@ files:
207
234
  - .yardopts
208
235
  - Appraisals
209
236
  - CHANGELOG
237
+ - DEPRECATIONS
210
238
  - Gemfile
211
239
  - MIT-LICENSE
212
240
  - README.textile
@@ -219,15 +247,18 @@ files:
219
247
  - gemfiles/rails_3.2.gemfile
220
248
  - gemfiles/rails_4.0.4.gemfile
221
249
  - gemfiles/rails_4.1.gemfile
250
+ - gemfiles/rails_4.2.gemfile
222
251
  - gemfiles/rails_4.gemfile
223
252
  - gemfiles/rails_edge.gemfile
224
253
  - lib/formtastic.rb
254
+ - lib/formtastic/action_class_finder.rb
225
255
  - lib/formtastic/actions.rb
226
256
  - lib/formtastic/actions/base.rb
227
257
  - lib/formtastic/actions/button_action.rb
228
258
  - lib/formtastic/actions/buttonish.rb
229
259
  - lib/formtastic/actions/input_action.rb
230
260
  - lib/formtastic/actions/link_action.rb
261
+ - lib/formtastic/deprecation.rb
231
262
  - lib/formtastic/engine.rb
232
263
  - lib/formtastic/form_builder.rb
233
264
  - lib/formtastic/helpers.rb
@@ -242,6 +273,7 @@ files:
242
273
  - lib/formtastic/helpers/reflection.rb
243
274
  - lib/formtastic/html_attributes.rb
244
275
  - lib/formtastic/i18n.rb
276
+ - lib/formtastic/input_class_finder.rb
245
277
  - lib/formtastic/inputs.rb
246
278
  - lib/formtastic/inputs/base.rb
247
279
  - lib/formtastic/inputs/base/associations.rb
@@ -266,6 +298,7 @@ files:
266
298
  - lib/formtastic/inputs/check_boxes_input.rb
267
299
  - lib/formtastic/inputs/color_input.rb
268
300
  - lib/formtastic/inputs/country_input.rb
301
+ - lib/formtastic/inputs/datalist_input.rb
269
302
  - lib/formtastic/inputs/date_picker_input.rb
270
303
  - lib/formtastic/inputs/date_select_input.rb
271
304
  - lib/formtastic/inputs/datetime_picker_input.rb
@@ -288,6 +321,7 @@ files:
288
321
  - lib/formtastic/inputs/url_input.rb
289
322
  - lib/formtastic/localized_string.rb
290
323
  - lib/formtastic/localizer.rb
324
+ - lib/formtastic/namespaced_class_finder.rb
291
325
  - lib/formtastic/util.rb
292
326
  - lib/formtastic/version.rb
293
327
  - lib/generators/formtastic/form/form_generator.rb
@@ -300,6 +334,7 @@ files:
300
334
  - sample/basic_inputs.html
301
335
  - sample/config.ru
302
336
  - sample/index.html
337
+ - spec/action_class_finder_spec.rb
303
338
  - spec/actions/button_action_spec.rb
304
339
  - spec/actions/generic_action_spec.rb
305
340
  - spec/actions/input_action_spec.rb
@@ -314,14 +349,18 @@ files:
314
349
  - spec/helpers/form_helper_spec.rb
315
350
  - spec/helpers/input_helper_spec.rb
316
351
  - spec/helpers/inputs_helper_spec.rb
352
+ - spec/helpers/namespaced_action_helper_spec.rb
353
+ - spec/helpers/namespaced_input_helper_spec.rb
317
354
  - spec/helpers/reflection_helper_spec.rb
318
355
  - spec/helpers/semantic_errors_helper_spec.rb
319
356
  - spec/i18n_spec.rb
357
+ - spec/input_class_finder_spec.rb
320
358
  - spec/inputs/boolean_input_spec.rb
321
359
  - spec/inputs/check_boxes_input_spec.rb
322
360
  - spec/inputs/color_input_spec.rb
323
361
  - spec/inputs/country_input_spec.rb
324
362
  - spec/inputs/custom_input_spec.rb
363
+ - spec/inputs/datalist_input_spec.rb
325
364
  - spec/inputs/date_picker_input_spec.rb
326
365
  - spec/inputs/date_select_input_spec.rb
327
366
  - spec/inputs/datetime_picker_input_spec.rb
@@ -347,39 +386,44 @@ files:
347
386
  - spec/inputs/url_input_spec.rb
348
387
  - spec/inputs/with_options_spec.rb
349
388
  - spec/localizer_spec.rb
389
+ - spec/namespaced_class_finder_spec.rb
350
390
  - spec/spec.opts
351
391
  - spec/spec_helper.rb
352
392
  - spec/support/custom_macros.rb
353
393
  - spec/support/deferred_garbage_collection.rb
354
394
  - spec/support/deprecation.rb
395
+ - spec/support/shared_examples.rb
396
+ - spec/support/specialized_class_finder_shared_example.rb
355
397
  - spec/support/test_environment.rb
356
398
  - spec/util_spec.rb
357
399
  homepage: http://github.com/justinfrench/formtastic
358
400
  licenses:
359
401
  - MIT
360
- metadata: {}
361
402
  post_install_message:
362
403
  rdoc_options:
363
404
  - --charset=UTF-8
364
405
  require_paths:
365
406
  - lib
366
407
  required_ruby_version: !ruby/object:Gem::Requirement
408
+ none: false
367
409
  requirements:
368
410
  - - ! '>='
369
411
  - !ruby/object:Gem::Version
370
412
  version: 1.9.3
371
413
  required_rubygems_version: !ruby/object:Gem::Requirement
414
+ none: false
372
415
  requirements:
373
416
  - - ! '>='
374
417
  - !ruby/object:Gem::Version
375
418
  version: '0'
376
419
  requirements: []
377
420
  rubyforge_project:
378
- rubygems_version: 2.4.1
421
+ rubygems_version: 1.8.23
379
422
  signing_key:
380
- specification_version: 4
423
+ specification_version: 3
381
424
  summary: A Rails form builder plugin/gem with semantically rich and accessible markup
382
425
  test_files:
426
+ - spec/action_class_finder_spec.rb
383
427
  - spec/actions/button_action_spec.rb
384
428
  - spec/actions/generic_action_spec.rb
385
429
  - spec/actions/input_action_spec.rb
@@ -394,14 +438,18 @@ test_files:
394
438
  - spec/helpers/form_helper_spec.rb
395
439
  - spec/helpers/input_helper_spec.rb
396
440
  - spec/helpers/inputs_helper_spec.rb
441
+ - spec/helpers/namespaced_action_helper_spec.rb
442
+ - spec/helpers/namespaced_input_helper_spec.rb
397
443
  - spec/helpers/reflection_helper_spec.rb
398
444
  - spec/helpers/semantic_errors_helper_spec.rb
399
445
  - spec/i18n_spec.rb
446
+ - spec/input_class_finder_spec.rb
400
447
  - spec/inputs/boolean_input_spec.rb
401
448
  - spec/inputs/check_boxes_input_spec.rb
402
449
  - spec/inputs/color_input_spec.rb
403
450
  - spec/inputs/country_input_spec.rb
404
451
  - spec/inputs/custom_input_spec.rb
452
+ - spec/inputs/datalist_input_spec.rb
405
453
  - spec/inputs/date_picker_input_spec.rb
406
454
  - spec/inputs/date_select_input_spec.rb
407
455
  - spec/inputs/datetime_picker_input_spec.rb
@@ -427,11 +475,14 @@ test_files:
427
475
  - spec/inputs/url_input_spec.rb
428
476
  - spec/inputs/with_options_spec.rb
429
477
  - spec/localizer_spec.rb
478
+ - spec/namespaced_class_finder_spec.rb
430
479
  - spec/spec.opts
431
480
  - spec/spec_helper.rb
432
481
  - spec/support/custom_macros.rb
433
482
  - spec/support/deferred_garbage_collection.rb
434
483
  - spec/support/deprecation.rb
484
+ - spec/support/shared_examples.rb
485
+ - spec/support/specialized_class_finder_shared_example.rb
435
486
  - spec/support/test_environment.rb
436
487
  - spec/util_spec.rb
437
488
  has_rdoc: