reform 2.2.4 → 2.3.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (103) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +5 -1
  3. data/.travis.yml +11 -6
  4. data/Appraisals +8 -0
  5. data/CHANGES.md +57 -4
  6. data/CONTRIBUTING.md +31 -0
  7. data/Gemfile +2 -16
  8. data/ISSUE_TEMPLATE.md +25 -0
  9. data/LICENSE.txt +1 -1
  10. data/README.md +5 -7
  11. data/Rakefile +16 -9
  12. data/gemfiles/0.13.0.gemfile +8 -0
  13. data/gemfiles/1.5.0.gemfile +9 -0
  14. data/lib/reform.rb +1 -0
  15. data/lib/reform/contract.rb +7 -17
  16. data/lib/reform/contract/custom_error.rb +41 -0
  17. data/lib/reform/contract/validate.rb +53 -23
  18. data/lib/reform/errors.rb +61 -0
  19. data/lib/reform/form.rb +36 -10
  20. data/lib/reform/form/call.rb +1 -1
  21. data/lib/reform/form/composition.rb +2 -2
  22. data/lib/reform/form/dry.rb +10 -58
  23. data/lib/reform/form/dry/input_hash.rb +37 -0
  24. data/lib/reform/form/dry/new_api.rb +45 -0
  25. data/lib/reform/form/dry/old_api.rb +61 -0
  26. data/lib/reform/form/populator.rb +11 -27
  27. data/lib/reform/form/prepopulate.rb +4 -3
  28. data/lib/reform/form/validate.rb +28 -13
  29. data/lib/reform/result.rb +90 -0
  30. data/lib/reform/validation.rb +19 -11
  31. data/lib/reform/validation/groups.rb +12 -27
  32. data/lib/reform/version.rb +1 -1
  33. data/reform.gemspec +14 -13
  34. data/test/benchmarking.rb +39 -6
  35. data/test/call_new_api.rb +23 -0
  36. data/test/call_old_api.rb +23 -0
  37. data/test/changed_test.rb +14 -14
  38. data/test/coercion_test.rb +57 -25
  39. data/test/composition_new_api.rb +186 -0
  40. data/test/composition_old_api.rb +184 -0
  41. data/test/contract/custom_error_test.rb +55 -0
  42. data/test/contract_new_api.rb +77 -0
  43. data/test/contract_old_api.rb +77 -0
  44. data/test/default_test.rb +4 -4
  45. data/test/deserialize_test.rb +17 -20
  46. data/test/errors_new_api.rb +225 -0
  47. data/test/errors_old_api.rb +230 -0
  48. data/test/feature_test.rb +10 -12
  49. data/test/fixtures/dry_error_messages.yml +73 -23
  50. data/test/fixtures/dry_new_api_error_messages.yml +104 -0
  51. data/test/form_new_api.rb +57 -0
  52. data/test/{form_test.rb → form_old_api.rb} +8 -8
  53. data/test/form_option_new_api.rb +24 -0
  54. data/test/{form_option_test.rb → form_option_old_api.rb} +5 -5
  55. data/test/from_test.rb +18 -22
  56. data/test/inherit_new_api.rb +105 -0
  57. data/test/inherit_old_api.rb +105 -0
  58. data/test/{module_test.rb → module_new_api.rb} +26 -31
  59. data/test/module_old_api.rb +146 -0
  60. data/test/parse_option_test.rb +40 -0
  61. data/test/parse_pipeline_test.rb +4 -4
  62. data/test/populate_new_api.rb +304 -0
  63. data/test/populate_old_api.rb +304 -0
  64. data/test/populator_skip_test.rb +11 -11
  65. data/test/prepopulator_test.rb +23 -24
  66. data/test/read_only_test.rb +12 -1
  67. data/test/readable_test.rb +9 -9
  68. data/test/reform_new_api.rb +204 -0
  69. data/test/{reform_test.rb → reform_old_api.rb} +44 -65
  70. data/test/save_new_api.rb +101 -0
  71. data/test/save_old_api.rb +101 -0
  72. data/test/setup_test.rb +17 -17
  73. data/test/skip_if_new_api.rb +85 -0
  74. data/test/skip_if_old_api.rb +92 -0
  75. data/test/skip_setter_and_getter_test.rb +9 -10
  76. data/test/test_helper.rb +25 -14
  77. data/test/validate_new_api.rb +453 -0
  78. data/test/{validate_test.rb → validate_old_api.rb} +121 -131
  79. data/test/validation/dry_validation_new_api.rb +835 -0
  80. data/test/validation/dry_validation_old_api.rb +772 -0
  81. data/test/validation/result_test.rb +77 -0
  82. data/test/validation_library_provided_test.rb +16 -0
  83. data/test/virtual_test.rb +47 -7
  84. data/test/writeable_test.rb +38 -9
  85. metadata +111 -56
  86. data/gemfiles/Gemfile.disposable-0.3 +0 -6
  87. data/lib/reform/contract/errors.rb +0 -43
  88. data/lib/reform/form/mongoid.rb +0 -37
  89. data/lib/reform/form/orm.rb +0 -26
  90. data/lib/reform/mongoid.rb +0 -4
  91. data/test/call_test.rb +0 -23
  92. data/test/composition_test.rb +0 -149
  93. data/test/contract_test.rb +0 -77
  94. data/test/deprecation_test.rb +0 -27
  95. data/test/errors_test.rb +0 -165
  96. data/test/inherit_test.rb +0 -119
  97. data/test/populate_test.rb +0 -270
  98. data/test/readonly_test.rb +0 -14
  99. data/test/save_test.rb +0 -89
  100. data/test/skip_if_test.rb +0 -74
  101. data/test/validation/dry_test.rb +0 -60
  102. data/test/validation/dry_validation_test.rb +0 -352
  103. data/test/validation/errors.yml +0 -4
@@ -1,25 +1,25 @@
1
- require 'test_helper'
1
+ require "test_helper"
2
2
 
3
3
  class ContractValidateTest < MiniTest::Spec
4
4
  Song = Struct.new(:title, :album, :composer)
5
5
  Album = Struct.new(:name, :songs, :artist)
6
6
  Artist = Struct.new(:name)
7
7
 
8
- class AlbumForm < Reform::Contract
8
+ class AlbumForm < TestContract
9
9
  property :name
10
10
  validation do
11
- key(:name).required
11
+ required(:name).filled
12
12
  end
13
13
 
14
14
  collection :songs do
15
15
  property :title
16
16
  validation do
17
- key(:title).required
17
+ required(:title).filled
18
18
  end
19
19
 
20
20
  property :composer do
21
21
  validation do
22
- key(:name).required
22
+ required(:name).filled
23
23
  end
24
24
  property :name
25
25
  end
@@ -30,18 +30,18 @@ class ContractValidateTest < MiniTest::Spec
30
30
  end
31
31
  end
32
32
 
33
- let (:song) { Song.new("Broken") }
34
- let (:song_with_composer) { Song.new("Resist Stance", nil, composer) }
35
- let (:composer) { Artist.new("Greg Graffin") }
36
- let (:artist) { Artist.new("Bad Religion") }
37
- let (:album) { Album.new("The Dissent Of Man", [song, song_with_composer], artist) }
33
+ let(:song) { Song.new("Broken") }
34
+ let(:song_with_composer) { Song.new("Resist Stance", nil, composer) }
35
+ let(:composer) { Artist.new("Greg Graffin") }
36
+ let(:artist) { Artist.new("Bad Religion") }
37
+ let(:album) { Album.new("The Dissent Of Man", [song, song_with_composer], artist) }
38
38
 
39
- let (:form) { AlbumForm.new(album) }
39
+ let(:form) { AlbumForm.new(album) }
40
40
 
41
41
  # valid
42
42
  it do
43
- form.validate.must_equal true
44
- form.errors.messages.inspect.must_equal "{}"
43
+ _(form.validate).must_equal true
44
+ _(form.errors.messages.inspect).must_equal "{}"
45
45
  end
46
46
 
47
47
  # invalid
@@ -49,35 +49,33 @@ class ContractValidateTest < MiniTest::Spec
49
49
  album.songs[1].composer.name = nil
50
50
  album.name = nil
51
51
 
52
- form.validate.must_equal false
53
- form.errors.messages.inspect.must_equal "{:name=>[\"is missing\"], :\"songs.composer.name\"=>[\"is missing\"]}"
52
+ _(form.validate).must_equal false
53
+ _(form.errors.messages.inspect).must_equal "{:name=>[\"must be filled\"], :\"songs.composer.name\"=>[\"must be filled\"]}"
54
54
  end
55
55
  end
56
56
 
57
-
58
57
  # no configuration results in "sync" (formerly known as parse_strategy: :sync).
59
58
  class ValidateWithoutConfigurationTest < MiniTest::Spec
60
59
  Song = Struct.new(:title, :album, :composer)
61
60
  Album = Struct.new(:name, :songs, :artist)
62
61
  Artist = Struct.new(:name)
63
62
 
64
- class AlbumForm < Reform::Form
63
+ class AlbumForm < TestForm
65
64
  property :name
66
65
  validation do
67
- key(:name).required
66
+ required(:name).filled
68
67
  end
69
68
 
70
69
  collection :songs do
71
-
72
70
  property :title
73
71
  validation do
74
- key(:title).required
72
+ required(:title).filled
75
73
  end
76
74
 
77
75
  property :composer do
78
76
  property :name
79
77
  validation do
80
- key(:name).required
78
+ required(:name).filled
81
79
  end
82
80
  end
83
81
  end
@@ -87,62 +85,63 @@ class ValidateWithoutConfigurationTest < MiniTest::Spec
87
85
  end
88
86
  end
89
87
 
90
- let (:song) { Song.new("Broken") }
91
- let (:song_with_composer) { Song.new("Resist Stance", nil, composer) }
92
- let (:composer) { Artist.new("Greg Graffin") }
93
- let (:artist) { Artist.new("Bad Religion") }
94
- let (:album) { Album.new("The Dissent Of Man", [song, song_with_composer], artist) }
88
+ let(:song) { Song.new("Broken") }
89
+ let(:song_with_composer) { Song.new("Resist Stance", nil, composer) }
90
+ let(:composer) { Artist.new("Greg Graffin") }
91
+ let(:artist) { Artist.new("Bad Religion") }
92
+ let(:album) { Album.new("The Dissent Of Man", [song, song_with_composer], artist) }
95
93
 
96
- let (:form) { AlbumForm.new(album) }
94
+ let(:form) { AlbumForm.new(album) }
97
95
 
98
96
  # valid.
99
97
  it do
100
- object_ids = {song: form.songs[0].object_id, song_with_composer: form.songs[1].object_id,
101
- artist: form.artist.object_id, composer: form.songs[1].composer.object_id}
98
+ object_ids = {
99
+ song: form.songs[0].object_id, song_with_composer: form.songs[1].object_id,
100
+ artist: form.artist.object_id, composer: form.songs[1].composer.object_id
101
+ }
102
102
 
103
- form.validate(
103
+ _(form.validate(
104
104
  "name" => "Best Of",
105
105
  "songs" => [{"title" => "Fallout"}, {"title" => "Roxanne", "composer" => {"name" => "Sting"}}],
106
- "artist" => {"name" => "The Police"},
107
- ).must_equal true
106
+ "artist" => {"name" => "The Police"}
107
+ )).must_equal true
108
108
 
109
- form.errors.messages.inspect.must_equal "{}"
109
+ _(form.errors.messages.inspect).must_equal "{}"
110
110
 
111
111
  # form has updated.
112
- form.name.must_equal "Best Of"
113
- form.songs[0].title.must_equal "Fallout"
114
- form.songs[1].title.must_equal "Roxanne"
115
- form.songs[1].composer.name.must_equal "Sting"
116
- form.artist.name.must_equal "The Police"
112
+ _(form.name).must_equal "Best Of"
113
+ _(form.songs[0].title).must_equal "Fallout"
114
+ _(form.songs[1].title).must_equal "Roxanne"
115
+ _(form.songs[1].composer.name).must_equal "Sting"
116
+ _(form.artist.name).must_equal "The Police"
117
117
 
118
118
  # objects are still the same.
119
- form.songs[0].object_id.must_equal object_ids[:song]
120
- form.songs[1].object_id.must_equal object_ids[:song_with_composer]
121
- form.songs[1].composer.object_id.must_equal object_ids[:composer]
122
- form.artist.object_id.must_equal object_ids[:artist]
123
-
119
+ _(form.songs[0].object_id).must_equal object_ids[:song]
120
+ _(form.songs[1].object_id).must_equal object_ids[:song_with_composer]
121
+ _(form.songs[1].composer.object_id).must_equal object_ids[:composer]
122
+ _(form.artist.object_id).must_equal object_ids[:artist]
124
123
 
125
124
  # model has not changed, yet.
126
- album.name.must_equal "The Dissent Of Man"
127
- album.songs[0].title.must_equal "Broken"
128
- album.songs[1].title.must_equal "Resist Stance"
129
- album.songs[1].composer.name.must_equal "Greg Graffin"
130
- album.artist.name.must_equal "Bad Religion"
125
+ _(album.name).must_equal "The Dissent Of Man"
126
+ _(album.songs[0].title).must_equal "Broken"
127
+ _(album.songs[1].title).must_equal "Resist Stance"
128
+ _(album.songs[1].composer.name).must_equal "Greg Graffin"
129
+ _(album.artist.name).must_equal "Bad Religion"
131
130
  end
132
131
 
133
132
  # with symbols.
134
133
  it do
135
- form.validate(
134
+ _(form.validate(
136
135
  name: "Best Of",
137
136
  songs: [{title: "The X-Creep"}, {title: "Trudging", composer: {name: "SNFU"}}],
138
- artist: {name: "The Police"},
139
- ).must_equal true
140
-
141
- form.name.must_equal "Best Of"
142
- form.songs[0].title.must_equal "The X-Creep"
143
- form.songs[1].title.must_equal "Trudging"
144
- form.songs[1].composer.name.must_equal "SNFU"
145
- form.artist.name.must_equal "The Police"
137
+ artist: {name: "The Police"}
138
+ )).must_equal true
139
+
140
+ _(form.name).must_equal "Best Of"
141
+ _(form.songs[0].title).must_equal "The X-Creep"
142
+ _(form.songs[1].title).must_equal "Trudging"
143
+ _(form.songs[1].composer.name).must_equal "SNFU"
144
+ _(form.artist.name).must_equal "The Police"
146
145
  end
147
146
 
148
147
  # throws exception when no populators.
@@ -160,131 +159,130 @@ class ValidateWithInternalPopulatorOptionTest < MiniTest::Spec
160
159
  Album = Struct.new(:name, :songs, :artist)
161
160
  Artist = Struct.new(:name)
162
161
 
163
- class AlbumForm < Reform::Form
162
+ class AlbumForm < TestForm
164
163
  property :name
165
164
  validation do
166
- key(:name).required
165
+ required(:name).filled
167
166
  end
168
167
 
169
168
  collection :songs,
170
- internal_populator: lambda { |input, options|
171
- collection = options[:represented].songs
172
- (item = collection[options[:index]]) ? item : collection.insert(options[:index], Song.new) } do
173
-
169
+ internal_populator: ->(input, options) {
170
+ collection = options[:represented].songs
171
+ (item = collection[options[:index]]) ? item : collection.insert(options[:index], Song.new)
172
+ } do
174
173
  property :title
175
174
  validation do
176
- key(:title).required
175
+ required(:title).filled
177
176
  end
178
177
 
179
- property :composer, internal_populator: lambda { |input, options| (item = options[:represented].composer) ? item : Artist.new } do
178
+ property :composer, internal_populator: ->(input, options) { (item = options[:represented].composer) ? item : Artist.new } do
180
179
  property :name
181
180
  validation do
182
- key(:name).required
181
+ required(:name).filled
183
182
  end
184
183
  end
185
184
  end
186
185
 
187
- property :artist, internal_populator: lambda { |input, options| (item = options[:represented].artist) ? item : Artist.new } do
186
+ property :artist, internal_populator: ->(input, options) { (item = options[:represented].artist) ? item : Artist.new } do
188
187
  property :name
189
188
  validation do
190
- key(:name).required
189
+ required(:name).filled
191
190
  end
192
191
  end
193
192
  end
194
193
 
195
- let (:song) { Song.new("Broken") }
196
- let (:song_with_composer) { Song.new("Resist Stance", nil, composer) }
197
- let (:composer) { Artist.new("Greg Graffin") }
198
- let (:artist) { Artist.new("Bad Religion") }
199
- let (:album) { Album.new("The Dissent Of Man", [song, song_with_composer], artist) }
194
+ let(:song) { Song.new("Broken") }
195
+ let(:song_with_composer) { Song.new("Resist Stance", nil, composer) }
196
+ let(:composer) { Artist.new("Greg Graffin") }
197
+ let(:artist) { Artist.new("Bad Religion") }
198
+ let(:album) { Album.new("The Dissent Of Man", [song, song_with_composer], artist) }
200
199
 
201
- let (:form) { AlbumForm.new(album) }
200
+ let(:form) { AlbumForm.new(album) }
202
201
 
203
202
  # valid.
204
203
  it("xxx") do
205
- form.validate(
204
+ _(form.validate(
206
205
  "name" => "Best Of",
207
206
  "songs" => [{"title" => "Fallout"}, {"title" => "Roxanne", "composer" => {"name" => "Sting"}}],
208
207
  "artist" => {"name" => "The Police"},
209
- ).must_equal true
208
+ )).must_equal true
209
+ _(form.valid?).must_equal true
210
210
 
211
- form.errors.messages.inspect.must_equal "{}"
211
+ _(form.errors.messages.inspect).must_equal "{}"
212
212
 
213
213
  # form has updated.
214
- form.name.must_equal "Best Of"
215
- form.songs[0].title.must_equal "Fallout"
216
- form.songs[1].title.must_equal "Roxanne"
217
- form.songs[1].composer.name.must_equal "Sting"
218
- form.artist.name.must_equal "The Police"
219
-
214
+ _(form.name).must_equal "Best Of"
215
+ _(form.songs[0].title).must_equal "Fallout"
216
+ _(form.songs[1].title).must_equal "Roxanne"
217
+ _(form.songs[1].composer.name).must_equal "Sting"
218
+ _(form.artist.name).must_equal "The Police"
220
219
 
221
220
  # model has not changed, yet.
222
- album.name.must_equal "The Dissent Of Man"
223
- album.songs[0].title.must_equal "Broken"
224
- album.songs[1].title.must_equal "Resist Stance"
225
- album.songs[1].composer.name.must_equal "Greg Graffin"
226
- album.artist.name.must_equal "Bad Religion"
221
+ _(album.name).must_equal "The Dissent Of Man"
222
+ _(album.songs[0].title).must_equal "Broken"
223
+ _(album.songs[1].title).must_equal "Resist Stance"
224
+ _(album.songs[1].composer.name).must_equal "Greg Graffin"
225
+ _(album.artist.name).must_equal "Bad Religion"
227
226
  end
228
227
 
229
228
  # invalid.
230
229
  it do
231
- form.validate(
230
+ _(form.validate(
232
231
  "name" => "",
233
232
  "songs" => [{"title" => "Fallout"}, {"title" => "Roxanne", "composer" => {"name" => ""}}],
234
233
  "artist" => {"name" => ""},
235
- ).must_equal false
234
+ )).must_equal false
235
+ _(form.valid?).must_equal false
236
236
 
237
- form.errors.messages.inspect.must_equal "{:name=>[\"must be filled\"], :\"songs.composer.name\"=>[\"must be filled\"], :\"artist.name\"=>[\"must be filled\"]}"
237
+ _(form.errors.messages.inspect).must_equal "{:name=>[\"must be filled\"], :\"songs.composer.name\"=>[\"must be filled\"], :\"artist.name\"=>[\"must be filled\"]}"
238
238
  end
239
239
 
240
240
  # adding to collection via :instance.
241
241
  # valid.
242
242
  it do
243
- form.validate(
243
+ _(form.validate(
244
244
  "songs" => [{"title" => "Fallout"}, {"title" => "Roxanne"}, {"title" => "Rime Of The Ancient Mariner"}],
245
- ).must_equal true
245
+ )).must_equal true
246
246
 
247
- form.errors.messages.inspect.must_equal "{}"
247
+ _(form.errors.messages.inspect).must_equal "{}"
248
248
 
249
249
  # form has updated.
250
- form.name.must_equal "The Dissent Of Man"
251
- form.songs[0].title.must_equal "Fallout"
252
- form.songs[1].title.must_equal "Roxanne"
253
- form.songs[1].composer.name.must_equal "Greg Graffin"
254
- form.songs[1].title.must_equal "Roxanne"
255
- form.songs[2].title.must_equal "Rime Of The Ancient Mariner" # new song added.
256
- form.songs.size.must_equal 3
257
- form.artist.name.must_equal "Bad Religion"
258
-
250
+ _(form.name).must_equal "The Dissent Of Man"
251
+ _(form.songs[0].title).must_equal "Fallout"
252
+ _(form.songs[1].title).must_equal "Roxanne"
253
+ _(form.songs[1].composer.name).must_equal "Greg Graffin"
254
+ _(form.songs[1].title).must_equal "Roxanne"
255
+ _(form.songs[2].title).must_equal "Rime Of The Ancient Mariner" # new song added.
256
+ _(form.songs.size).must_equal 3
257
+ _(form.artist.name).must_equal "Bad Religion"
259
258
 
260
259
  # model has not changed, yet.
261
- album.name.must_equal "The Dissent Of Man"
262
- album.songs[0].title.must_equal "Broken"
263
- album.songs[1].title.must_equal "Resist Stance"
264
- album.songs[1].composer.name.must_equal "Greg Graffin"
265
- album.songs.size.must_equal 2
266
- album.artist.name.must_equal "Bad Religion"
260
+ _(album.name).must_equal "The Dissent Of Man"
261
+ _(album.songs[0].title).must_equal "Broken"
262
+ _(album.songs[1].title).must_equal "Resist Stance"
263
+ _(album.songs[1].composer.name).must_equal "Greg Graffin"
264
+ _(album.songs.size).must_equal 2
265
+ _(album.artist.name).must_equal "Bad Religion"
267
266
  end
268
267
 
269
-
270
268
  # allow writeable: false even in the deserializer.
271
- class SongForm < Reform::Form
269
+ class SongForm < TestForm
272
270
  property :title, deserializer: {writeable: false}
273
271
  end
274
272
 
275
273
  it do
276
274
  form = SongForm.new(song = Song.new)
277
275
  form.validate("title" => "Ignore me!")
278
- form.title.must_equal nil
276
+ assert_nil form.title
279
277
  form.title = "Unopened"
280
278
  form.sync # only the deserializer is marked as not-writeable.
281
- song.title.must_equal "Unopened"
279
+ _(song.title).must_equal "Unopened"
282
280
  end
283
281
  end
284
282
 
285
- # # not sure if we should catch that in Reform or rather do that in disposable. this is https://github.com/apotonick/reform/pull/104
283
+ # # not sure if we should catch that in Reform or rather do that in disposable. this is https://github.com/trailblazer/reform/pull/104
286
284
  # # describe ":populator with :empty" do
287
- # # let (:form) {
285
+ # # let(:form) {
288
286
  # # Class.new(Reform::Form) do
289
287
  # # collection :songs, :empty => true, :populator => lambda { |fragment, index, args|
290
288
  # # songs[index] = args.binding[:form].new(Song.new)
@@ -294,7 +292,7 @@ end
294
292
  # # end
295
293
  # # }
296
294
 
297
- # # let (:params) {
295
+ # # let(:params) {
298
296
  # # {
299
297
  # # "songs" => [{"title" => "Fallout"}, {"title" => "Roxanne"}]
300
298
  # # }
@@ -308,10 +306,9 @@ end
308
306
  # # it { subject.songs[1].title.must_equal "Roxanne" }
309
307
  # # end
310
308
 
311
-
312
309
  # # test cardinalities.
313
310
  # describe "with empty collection and cardinality" do
314
- # let (:album) { Album.new }
311
+ # let(:album) { Album.new }
315
312
 
316
313
  # subject { Class.new(Reform::Form) do
317
314
  # include Reform::Form::ActiveModel
@@ -329,7 +326,6 @@ end
329
326
  # validates :hit, :presence => true
330
327
  # end.new(album) }
331
328
 
332
-
333
329
  # describe "invalid" do
334
330
  # before { subject.validate({}).must_equal false }
335
331
 
@@ -342,9 +338,8 @@ end
342
338
  # end
343
339
  # end
344
340
 
345
-
346
341
  # describe "valid" do
347
- # let (:album) { Album.new(nil, Song.new, [Song.new("Urban Myth")]) }
342
+ # let(:album) { Album.new(nil, Song.new, [Song.new("Urban Myth")]) }
348
343
 
349
344
  # before {
350
345
  # subject.validate({"songs" => [{"title"=>"Daddy, Brother, Lover, Little Boy"}], "hit" => {"title"=>"The Horse"}}).
@@ -355,13 +350,9 @@ end
355
350
  # end
356
351
  # end
357
352
 
358
-
359
-
360
-
361
-
362
353
  # # providing manual validator method allows accessing form's API.
363
354
  # describe "with ::validate" do
364
- # let (:form) {
355
+ # let(:form) {
365
356
  # Class.new(Reform::Form) do
366
357
  # property :title
367
358
 
@@ -373,8 +364,8 @@ end
373
364
  # end
374
365
  # }
375
366
 
376
- # let (:params) { {"title" => "Fallout"} }
377
- # let (:song) { Song.new("Englishman") }
367
+ # let(:params) { {"title" => "Fallout"} }
368
+ # let(:song) { Song.new("Englishman") }
378
369
 
379
370
  # subject { form.new(song) }
380
371
 
@@ -384,10 +375,9 @@ end
384
375
  # it { subject.errors.messages.must_equal({:title=>["not lowercase"]}) }
385
376
  # end
386
377
 
387
-
388
378
  # # overriding the reader for a nested form should only be considered when rendering.
389
379
  # describe "with overridden reader for nested form" do
390
- # let (:form) {
380
+ # let(:form) {
391
381
  # Class.new(Reform::Form) do
392
382
  # property :band, :populate_if_empty => lambda { |*| Band.new } do
393
383
  # property :label
@@ -407,7 +397,7 @@ end
407
397
  # end.new(album)
408
398
  # }
409
399
 
410
- # let (:album) { Album.new }
400
+ # let(:album) { Album.new }
411
401
 
412
402
  # # don't use #artist when validating!
413
403
  # it do