reform 2.3.2 → 2.3.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +4 -0
  3. data/lib/reform/form/dry/new_api.rb +2 -4
  4. data/lib/reform/version.rb +1 -1
  5. data/test/call_new_api.rb +6 -6
  6. data/test/call_old_api.rb +6 -6
  7. data/test/changed_test.rb +6 -6
  8. data/test/coercion_test.rb +13 -13
  9. data/test/composition_new_api.rb +24 -24
  10. data/test/composition_old_api.rb +24 -24
  11. data/test/contract_new_api.rb +8 -8
  12. data/test/contract_old_api.rb +8 -8
  13. data/test/default_test.rb +2 -2
  14. data/test/deserialize_test.rb +8 -8
  15. data/test/errors_new_api.rb +38 -38
  16. data/test/errors_old_api.rb +38 -38
  17. data/test/feature_test.rb +2 -2
  18. data/test/form_new_api.rb +3 -3
  19. data/test/form_old_api.rb +3 -3
  20. data/test/form_option_new_api.rb +1 -1
  21. data/test/form_option_old_api.rb +1 -1
  22. data/test/from_test.rb +10 -10
  23. data/test/inherit_new_api.rb +17 -17
  24. data/test/inherit_old_api.rb +17 -17
  25. data/test/module_new_api.rb +8 -8
  26. data/test/module_old_api.rb +9 -9
  27. data/test/parse_option_test.rb +7 -7
  28. data/test/parse_pipeline_test.rb +1 -1
  29. data/test/populate_new_api.rb +53 -53
  30. data/test/populate_old_api.rb +53 -53
  31. data/test/populator_skip_test.rb +2 -2
  32. data/test/prepopulator_test.rb +15 -15
  33. data/test/read_only_test.rb +2 -2
  34. data/test/readable_test.rb +3 -3
  35. data/test/reform_new_api.rb +19 -19
  36. data/test/reform_old_api.rb +19 -19
  37. data/test/save_new_api.rb +4 -4
  38. data/test/save_old_api.rb +4 -4
  39. data/test/setup_test.rb +9 -9
  40. data/test/skip_if_new_api.rb +12 -12
  41. data/test/skip_if_old_api.rb +15 -15
  42. data/test/skip_setter_and_getter_test.rb +6 -6
  43. data/test/validate_new_api.rb +62 -62
  44. data/test/validate_old_api.rb +64 -64
  45. data/test/validation/dry_validation_new_api.rb +115 -116
  46. data/test/validation/dry_validation_old_api.rb +105 -105
  47. data/test/validation/result_test.rb +14 -14
  48. data/test/virtual_test.rb +7 -7
  49. data/test/writeable_test.rb +8 -8
  50. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1632a1964f6950c4451e586caae9bfe4766501e22c6e7961c442aae3327c6b8f
4
- data.tar.gz: cfa18510a8fad6eab78a5d7ffdb890b3f8e80dbbe2dcb7390a386fded0b7f479
3
+ metadata.gz: 0f5d5dea8c04f5d993a91776afffea2a0b48603d850c11204d04e79248be6cf8
4
+ data.tar.gz: e4132e9db35384198bf31797b8620219c6418df4781a8f5300bbcf38c1a1c630
5
5
  SHA512:
6
- metadata.gz: af8948ced80b6370a1878317d5cb99609c64e073c6206c511825358a9535de70f1ef34791d06fd240f864554b00ef8e04a595b8993aefa8d9f49580b6644c226
7
- data.tar.gz: c3f5a610f6dad84cb451f8880aa84294cfbf610649fc33aba20cf69b0be0414868b77756843b3c842a872c54dfbab759f40b15505b2e19c3075e5010119076c5
6
+ metadata.gz: '0845ada0bbafc7c3a45485d51f93c66c8616bee7b23c851712d297be20c73e82f23a8e575f803adb2972c382c4c9003951ae8d788fe12df87195950490505028'
7
+ data.tar.gz: bd463ddb326f4db34ef9ad6948cdb9466a56c87514f2a18fcafba6dff29b54baf5640b97b490657b92e438c336869f35adc3e407b91be80351f427fd84f28c35
data/CHANGES.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 2.3.3
2
+
3
+ * Rename validation option for dry-v 1+ to `contract` instead of `schema`
4
+
1
5
  ## 2.3.2
2
6
 
3
7
  * Fix Validation block option :form incorrectly memoized between tests
@@ -20,8 +20,8 @@ module Reform::Form::Dry
20
20
  class Group
21
21
  include InputHash
22
22
 
23
- def initialize(options = {})
24
- @validator = options.fetch(:schema, Contract)
23
+ def initialize(**options)
24
+ @validator = options.fetch(:contract, Contract)
25
25
  @schema_inject_params = options.fetch(:with, {})
26
26
  end
27
27
 
@@ -32,8 +32,6 @@ module Reform::Form::Dry
32
32
  end
33
33
 
34
34
  def call(form)
35
- # when passing options[:schema] the class instance is already created so we just need to call
36
- # "call"
37
35
  return validator.call(input_hash(form)) unless validator.is_a?(Class) && @validator <= ::Dry::Validation::Contract
38
36
 
39
37
  dynamic_options = { form: form }
@@ -1,3 +1,3 @@
1
1
  module Reform
2
- VERSION = "2.3.2".freeze
2
+ VERSION = "2.3.3".freeze
3
3
  end
@@ -13,11 +13,11 @@ class CallTest < Minitest::Spec
13
13
 
14
14
  let(:form) { SongForm.new(Song.new) }
15
15
 
16
- it { form.(title: "True North").success?.must_equal true }
17
- it { form.(title: "True North").failure?.must_equal false }
18
- it { form.(title: "").success?.must_equal false }
19
- it { form.(title: "").failure?.must_equal true }
16
+ it { _(form.(title: "True North").success?).must_equal true }
17
+ it { _(form.(title: "True North").failure?).must_equal false }
18
+ it { _(form.(title: "").success?).must_equal false }
19
+ it { _(form.(title: "").failure?).must_equal true }
20
20
 
21
- it { form.(title: "True North").errors.messages.must_equal({}) }
22
- it { form.(title: "").errors.messages.must_equal(title: ["must be filled"]) }
21
+ it { _(form.(title: "True North").errors.messages).must_equal({}) }
22
+ it { _(form.(title: "").errors.messages).must_equal(title: ["must be filled"]) }
23
23
  end
@@ -13,11 +13,11 @@ class CallTest < Minitest::Spec
13
13
 
14
14
  let(:form) { SongForm.new(Song.new) }
15
15
 
16
- it { form.(title: "True North").success?.must_equal true }
17
- it { form.(title: "True North").failure?.must_equal false }
18
- it { form.(title: "").success?.must_equal false }
19
- it { form.(title: "").failure?.must_equal true }
16
+ it { _(form.(title: "True North").success?).must_equal true }
17
+ it { _(form.(title: "True North").failure?).must_equal false }
18
+ it { _(form.(title: "").success?).must_equal false }
19
+ it { _(form.(title: "").failure?).must_equal true }
20
20
 
21
- it { form.(title: "True North").errors.messages.must_equal({}) }
22
- it { form.(title: "").errors.messages.must_equal(title: ["must be filled"]) }
21
+ it { _(form.(title: "True North").errors.messages).must_equal({}) }
22
+ it { _(form.(title: "").errors.messages).must_equal(title: ["must be filled"]) }
23
23
  end
@@ -26,16 +26,16 @@ class ChangedTest < MiniTest::Spec
26
26
 
27
27
  # nothing changed after setup.
28
28
  it do
29
- form.changed?(:name).must_equal false
30
- form.songs[0].changed?(:title).must_equal false
31
- form.songs[0].composer.changed?(:name).must_equal false
29
+ _(form.changed?(:name)).must_equal false
30
+ _(form.songs[0].changed?(:title)).must_equal false
31
+ _(form.songs[0].composer.changed?(:name)).must_equal false
32
32
  end
33
33
 
34
34
  # after validate, things might have changed.
35
35
  it do
36
36
  form.validate("name" => "Out Of Bounds", "songs" => [{"composer" => {"name" => "Ingemar Jansson & Mikael Danielsson"}}])
37
- form.changed?(:name).must_equal true
38
- form.songs[0].changed?(:title).must_equal false
39
- form.songs[0].composer.changed?(:name).must_equal true
37
+ _(form.changed?(:name)).must_equal true
38
+ _(form.songs[0].changed?(:title)).must_equal false
39
+ _(form.songs[0].composer.changed?(:name)).must_equal true
40
40
  end
41
41
  end
@@ -47,9 +47,9 @@ class CoercionTest < BaseTest
47
47
  end
48
48
 
49
49
  # it { subject.released_at.must_be_kind_of DateTime }
50
- it { subject.released_at.must_equal "31/03/1981" } # NO coercion in setup.
51
- it { subject.hit.length.must_equal "312" }
52
- it { subject.band.label.value.must_equal "9999.99" }
50
+ it { _(subject.released_at).must_equal "31/03/1981" } # NO coercion in setup.
51
+ it { _(subject.hit.length).must_equal "312" }
52
+ it { _(subject.band.label.value).must_equal "9999.99" }
53
53
 
54
54
  let(:params) do
55
55
  {
@@ -75,24 +75,24 @@ class CoercionTest < BaseTest
75
75
  describe "#validate" do
76
76
  before { subject.validate(params) }
77
77
 
78
- it { subject.released_at.must_equal DateTime.parse("30/03/1981") }
79
- it { subject.hit.length.must_equal 312 }
80
- it { subject.hit.good.must_equal false }
81
- it { subject.band.label.value.must_equal "9999.999999.99" } # coercion happened once.
82
- it { subject.metadata.publication_settings.featured.must_equal false }
78
+ it { _(subject.released_at).must_equal DateTime.parse("30/03/1981") }
79
+ it { _(subject.hit.length).must_equal 312 }
80
+ it { _(subject.hit.good).must_equal false }
81
+ it { _(subject.band.label.value).must_equal "9999.999999.99" } # coercion happened once.
82
+ it { _(subject.metadata.publication_settings.featured).must_equal false }
83
83
  end
84
84
 
85
85
  # sync
86
86
  describe "#sync" do
87
87
  before do
88
- subject.validate(params).must_equal true
88
+ _(subject.validate(params)).must_equal true
89
89
  subject.sync
90
90
  end
91
91
 
92
- it { album.released_at.must_equal DateTime.parse("30/03/1981") }
93
- it { album.hit.length.must_equal 312 }
94
- it { album.hit.good.must_equal false }
92
+ it { _(album.released_at).must_equal DateTime.parse("30/03/1981") }
93
+ it { _(album.hit.length).must_equal 312 }
94
+ it { _(album.hit.good).must_equal false }
95
95
  it { assert_nil album.metadata[:publication_settings] }
96
- it { album.metadata["publication_settings"]["featured"].must_equal false }
96
+ it { _(album.metadata["publication_settings"]["featured"]).must_equal false }
97
97
  end
98
98
  end
@@ -33,8 +33,8 @@ class FormCompositionInheritanceTest < MiniTest::Spec
33
33
  Tshirt = Struct.new(:price, :size)
34
34
  Measurement = Struct.new(:size)
35
35
 
36
- it { form.price.must_equal 6 }
37
- it { form.price(for_size: :s).must_equal 2 }
36
+ it { _(form.price).must_equal 6 }
37
+ it { _(form.price(for_size: :s)).must_equal 2 }
38
38
  end
39
39
 
40
40
  class FormCompositionTest < MiniTest::Spec
@@ -71,24 +71,24 @@ class FormCompositionTest < MiniTest::Spec
71
71
  let(:band) { Band.new("Duran^2") }
72
72
 
73
73
  # delegation form -> composition works
74
- it { form.id.must_equal 1 }
75
- it { form.title.must_equal "Rio" }
76
- it { form.name.must_equal "Duran Duran" }
77
- it { form.requester_id.must_equal 2 }
74
+ it { _(form.id).must_equal 1 }
75
+ it { _(form.title).must_equal "Rio" }
76
+ it { _(form.name).must_equal "Duran Duran" }
77
+ it { _(form.requester_id).must_equal 2 }
78
78
  it { assert_nil form.channel }
79
- it { form.requester.must_equal "MCP" } # same name as composed model.
79
+ it { _(form.requester).must_equal "MCP" } # same name as composed model.
80
80
  it { assert_nil form.captcha }
81
81
 
82
82
  # #model just returns <Composition>.
83
- it { form.mapper.must_be_kind_of Disposable::Composition }
83
+ it { _(form.mapper).must_be_kind_of Disposable::Composition }
84
84
 
85
85
  # #model[] -> composed models
86
- it { form.model[:requester].must_equal requester }
87
- it { form.model[:song].must_equal song }
86
+ it { _(form.model[:requester]).must_equal requester }
87
+ it { _(form.model[:song]).must_equal song }
88
88
 
89
89
  it "creates Composition for you" do
90
- form.validate("title" => "Greyhound", "name" => "Frenzal Rhomb").must_equal true
91
- form.validate("title" => "", "name" => "Frenzal Rhomb").must_equal false
90
+ _(form.validate("title" => "Greyhound", "name" => "Frenzal Rhomb")).must_equal true
91
+ _(form.validate("title" => "", "name" => "Frenzal Rhomb")).must_equal false
92
92
  end
93
93
 
94
94
  describe "#save" do
@@ -101,7 +101,7 @@ class FormCompositionTest < MiniTest::Spec
101
101
  hash[:title] = form.title
102
102
  end
103
103
 
104
- hash.must_equal({name: "Duran Duran", title: "Rio"})
104
+ _(hash).must_equal({name: "Duran Duran", title: "Rio"})
105
105
  end
106
106
 
107
107
  it "provides nested symbolized hash as second block argument" do
@@ -113,7 +113,7 @@ class FormCompositionTest < MiniTest::Spec
113
113
  hash = map
114
114
  end
115
115
 
116
- hash.must_equal({
116
+ _(hash).must_equal({
117
117
  song: {"title" => "Greyhound", "id" => 1, "channel" => "JJJ", "captcha" => "wonderful", "band" => {"title" => "Duran^2"}},
118
118
  requester: {"name" => "Frenzal Rhomb", "id" => 2, "requester" => "MCP"}
119
119
  }
@@ -126,16 +126,16 @@ class FormCompositionTest < MiniTest::Spec
126
126
  band.extend(Saveable)
127
127
 
128
128
  form.validate("title" => "Greyhound", "name" => "Frenzal Rhomb", "captcha" => "1337")
129
- form.captcha.must_equal "1337" # TODO: move to separate test.
129
+ _(form.captcha).must_equal "1337" # TODO: move to separate test.
130
130
 
131
131
  form.save
132
132
 
133
- requester.name.must_equal "Frenzal Rhomb"
134
- requester.saved?.must_equal true
135
- song.title.must_equal "Greyhound"
136
- song.saved?.must_equal true
137
- song.band.title.must_equal "Duran^2"
138
- song.band.saved?.must_equal true
133
+ _(requester.name).must_equal "Frenzal Rhomb"
134
+ _(requester.saved?).must_equal true
135
+ _(song.title).must_equal "Greyhound"
136
+ _(song.saved?).must_equal true
137
+ _(song.band.title).must_equal "Duran^2"
138
+ _(song.band.saved?).must_equal true
139
139
  end
140
140
 
141
141
  it "returns true when models all save successfully" do
@@ -143,7 +143,7 @@ class FormCompositionTest < MiniTest::Spec
143
143
  requester.extend(Saveable)
144
144
  band.extend(Saveable)
145
145
 
146
- form.save.must_equal true
146
+ _(form.save).must_equal true
147
147
  end
148
148
 
149
149
  it "returns false when one or more models don't save successfully" do
@@ -157,7 +157,7 @@ class FormCompositionTest < MiniTest::Spec
157
157
  requester.extend(Saveable)
158
158
  band.extend(Saveable)
159
159
 
160
- form.save.must_equal false
160
+ _(form.save).must_equal false
161
161
  end
162
162
  end
163
163
  end
@@ -182,5 +182,5 @@ class FormCompositionCollectionTest < MiniTest::Spec
182
182
  let(:form) { LibraryForm.new(library: library) }
183
183
  let(:library) { Library.new(2) }
184
184
 
185
- it { form.save { |hash| hash.must_equal({library: {"books" => [{"id" => 1, "name" => "My book"}]}}) } }
185
+ it { form.save { |hash| _(hash).must_equal({library: {"books" => [{"id" => 1, "name" => "My book"}]}}) } }
186
186
  end
@@ -33,8 +33,8 @@ class FormCompositionInheritanceTest < MiniTest::Spec
33
33
  Tshirt = Struct.new(:price, :size)
34
34
  Measurement = Struct.new(:size)
35
35
 
36
- it { form.price.must_equal 6 }
37
- it { form.price(for_size: :s).must_equal 2 }
36
+ it { _(form.price).must_equal 6 }
37
+ it { _(form.price(for_size: :s)).must_equal 2 }
38
38
  end
39
39
 
40
40
  class FormCompositionTest < MiniTest::Spec
@@ -69,24 +69,24 @@ class FormCompositionTest < MiniTest::Spec
69
69
  let(:band) { Band.new("Duran^2") }
70
70
 
71
71
  # delegation form -> composition works
72
- it { form.id.must_equal 1 }
73
- it { form.title.must_equal "Rio" }
74
- it { form.name.must_equal "Duran Duran" }
75
- it { form.requester_id.must_equal 2 }
72
+ it { _(form.id).must_equal 1 }
73
+ it { _(form.title).must_equal "Rio" }
74
+ it { _(form.name).must_equal "Duran Duran" }
75
+ it { _(form.requester_id).must_equal 2 }
76
76
  it { assert_nil form.channel }
77
- it { form.requester.must_equal "MCP" } # same name as composed model.
77
+ it { _(form.requester).must_equal "MCP" } # same name as composed model.
78
78
  it { assert_nil form.captcha }
79
79
 
80
80
  # #model just returns <Composition>.
81
- it { form.mapper.must_be_kind_of Disposable::Composition }
81
+ it { _(form.mapper).must_be_kind_of Disposable::Composition }
82
82
 
83
83
  # #model[] -> composed models
84
- it { form.model[:requester].must_equal requester }
85
- it { form.model[:song].must_equal song }
84
+ it { _(form.model[:requester]).must_equal requester }
85
+ it { _(form.model[:song]).must_equal song }
86
86
 
87
87
  it "creates Composition for you" do
88
- form.validate("title" => "Greyhound", "name" => "Frenzal Rhomb").must_equal true
89
- form.validate("title" => "", "name" => "Frenzal Rhomb").must_equal false
88
+ _(form.validate("title" => "Greyhound", "name" => "Frenzal Rhomb")).must_equal true
89
+ _(form.validate("title" => "", "name" => "Frenzal Rhomb")).must_equal false
90
90
  end
91
91
 
92
92
  describe "#save" do
@@ -99,7 +99,7 @@ class FormCompositionTest < MiniTest::Spec
99
99
  hash[:title] = form.title
100
100
  end
101
101
 
102
- hash.must_equal({name: "Duran Duran", title: "Rio"})
102
+ _(hash).must_equal({name: "Duran Duran", title: "Rio"})
103
103
  end
104
104
 
105
105
  it "provides nested symbolized hash as second block argument" do
@@ -111,7 +111,7 @@ class FormCompositionTest < MiniTest::Spec
111
111
  hash = map
112
112
  end
113
113
 
114
- hash.must_equal({
114
+ _(hash).must_equal({
115
115
  song: {"title" => "Greyhound", "id" => 1, "channel" => "JJJ", "captcha" => "wonderful", "band" => {"title" => "Duran^2"}},
116
116
  requester: {"name" => "Frenzal Rhomb", "id" => 2, "requester" => "MCP"}
117
117
  }
@@ -124,16 +124,16 @@ class FormCompositionTest < MiniTest::Spec
124
124
  band.extend(Saveable)
125
125
 
126
126
  form.validate("title" => "Greyhound", "name" => "Frenzal Rhomb", "captcha" => "1337")
127
- form.captcha.must_equal "1337" # TODO: move to separate test.
127
+ _(form.captcha).must_equal "1337" # TODO: move to separate test.
128
128
 
129
129
  form.save
130
130
 
131
- requester.name.must_equal "Frenzal Rhomb"
132
- requester.saved?.must_equal true
133
- song.title.must_equal "Greyhound"
134
- song.saved?.must_equal true
135
- song.band.title.must_equal "Duran^2"
136
- song.band.saved?.must_equal true
131
+ _(requester.name).must_equal "Frenzal Rhomb"
132
+ _(requester.saved?).must_equal true
133
+ _(song.title).must_equal "Greyhound"
134
+ _(song.saved?).must_equal true
135
+ _(song.band.title).must_equal "Duran^2"
136
+ _(song.band.saved?).must_equal true
137
137
  end
138
138
 
139
139
  it "returns true when models all save successfully" do
@@ -141,7 +141,7 @@ class FormCompositionTest < MiniTest::Spec
141
141
  requester.extend(Saveable)
142
142
  band.extend(Saveable)
143
143
 
144
- form.save.must_equal true
144
+ _(form.save).must_equal true
145
145
  end
146
146
 
147
147
  it "returns false when one or more models don't save successfully" do
@@ -155,7 +155,7 @@ class FormCompositionTest < MiniTest::Spec
155
155
  requester.extend(Saveable)
156
156
  band.extend(Saveable)
157
157
 
158
- form.save.must_equal false
158
+ _(form.save).must_equal false
159
159
  end
160
160
  end
161
161
  end
@@ -180,5 +180,5 @@ class FormCompositionCollectionTest < MiniTest::Spec
180
180
  let(:form) { LibraryForm.new(library: library) }
181
181
  let(:library) { Library.new(2) }
182
182
 
183
- it { form.save { |hash| hash.must_equal({library: {"books" => [{"id" => 1, "name" => "My book"}]}}) } }
183
+ it { form.save { |hash| _(hash).must_equal({library: {"books" => [{"id" => 1, "name" => "My book"}]}}) } }
184
184
  end
@@ -46,32 +46,32 @@ class ContractTest < MiniTest::Spec
46
46
 
47
47
  # accept `property form: SongForm`.
48
48
  it do
49
- form.artist.must_be_instance_of ArtistForm
49
+ _(form.artist).must_be_instance_of ArtistForm
50
50
  end
51
51
 
52
52
  describe ".properties" do
53
53
  it "defines a property when called with one argument" do
54
- form.must_respond_to :duration
54
+ _(form).must_respond_to :duration
55
55
  end
56
56
 
57
57
  it "defines several properties when called with multiple arguments" do
58
- form.must_respond_to :year
59
- form.must_respond_to :style
58
+ _(form).must_respond_to :year
59
+ _(form).must_respond_to :style
60
60
  end
61
61
 
62
62
  it "passes options to each property when options are provided" do
63
63
  readable = AlbumForm.new(album).options_for(:style)[:readable]
64
- readable.must_equal false
64
+ _(readable).must_equal false
65
65
  end
66
66
 
67
67
  it "returns the list of defined properties" do
68
68
  returned_value = AlbumForm.properties(:hello, :world, virtual: true)
69
- returned_value.must_equal %i[hello world]
69
+ _(returned_value).must_equal %i[hello world]
70
70
  end
71
71
  end
72
72
 
73
73
  describe "#options_for" do
74
- it { AlbumForm.options_for(:name).extend(Declarative::Inspect).inspect.must_equal "#<Disposable::Twin::Definition: @options={:private_name=>:name, :name=>\"name\"}>" }
75
- it { AlbumForm.new(album).options_for(:name).extend(Declarative::Inspect).inspect.must_equal "#<Disposable::Twin::Definition: @options={:private_name=>:name, :name=>\"name\"}>" }
74
+ it { _(AlbumForm.options_for(:name).extend(Declarative::Inspect).inspect).must_equal "#<Disposable::Twin::Definition: @options={:private_name=>:name, :name=>\"name\"}>" }
75
+ it { _(AlbumForm.new(album).options_for(:name).extend(Declarative::Inspect).inspect).must_equal "#<Disposable::Twin::Definition: @options={:private_name=>:name, :name=>\"name\"}>" }
76
76
  end
77
77
  end
@@ -46,32 +46,32 @@ class ContractTest < MiniTest::Spec
46
46
 
47
47
  # accept `property form: SongForm`.
48
48
  it do
49
- form.artist.must_be_instance_of ArtistForm
49
+ _(form.artist).must_be_instance_of ArtistForm
50
50
  end
51
51
 
52
52
  describe ".properties" do
53
53
  it "defines a property when called with one argument" do
54
- form.must_respond_to :duration
54
+ _(form).must_respond_to :duration
55
55
  end
56
56
 
57
57
  it "defines several properties when called with multiple arguments" do
58
- form.must_respond_to :year
59
- form.must_respond_to :style
58
+ _(form).must_respond_to :year
59
+ _(form).must_respond_to :style
60
60
  end
61
61
 
62
62
  it "passes options to each property when options are provided" do
63
63
  readable = AlbumForm.new(album).options_for(:style)[:readable]
64
- readable.must_equal false
64
+ _(readable).must_equal false
65
65
  end
66
66
 
67
67
  it "returns the list of defined properties" do
68
68
  returned_value = AlbumForm.properties(:hello, :world, virtual: true)
69
- returned_value.must_equal %i[hello world]
69
+ _(returned_value).must_equal %i[hello world]
70
70
  end
71
71
  end
72
72
 
73
73
  describe "#options_for" do
74
- it { AlbumForm.options_for(:name).extend(Declarative::Inspect).inspect.must_equal "#<Disposable::Twin::Definition: @options={:private_name=>:name, :name=>\"name\"}>" }
75
- it { AlbumForm.new(album).options_for(:name).extend(Declarative::Inspect).inspect.must_equal "#<Disposable::Twin::Definition: @options={:private_name=>:name, :name=>\"name\"}>" }
74
+ it { _(AlbumForm.options_for(:name).extend(Declarative::Inspect).inspect).must_equal "#<Disposable::Twin::Definition: @options={:private_name=>:name, :name=>\"name\"}>" }
75
+ it { _(AlbumForm.new(album).options_for(:name).extend(Declarative::Inspect).inspect).must_equal "#<Disposable::Twin::Definition: @options={:private_name=>:name, :name=>\"name\"}>" }
76
76
  end
77
77
  end