disposable 0.4.3 → 0.5.0

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 (57) hide show
  1. checksums.yaml +5 -5
  2. data/.github/workflows/ci.yml +29 -0
  3. data/.gitignore +1 -0
  4. data/CHANGES.md +23 -0
  5. data/Gemfile +5 -12
  6. data/README.md +2 -2
  7. data/disposable.gemspec +6 -9
  8. data/lib/disposable/rescheme.rb +1 -3
  9. data/lib/disposable/twin.rb +7 -0
  10. data/lib/disposable/twin/coercion.rb +11 -3
  11. data/lib/disposable/twin/default.rb +3 -3
  12. data/lib/disposable/twin/property/struct.rb +3 -1
  13. data/lib/disposable/twin/setup.rb +1 -1
  14. data/lib/disposable/twin/sync.rb +1 -1
  15. data/lib/disposable/version.rb +1 -1
  16. data/test/callback_group_test.rb +29 -30
  17. data/test/callbacks_test.rb +49 -49
  18. data/test/expose_test.rb +16 -16
  19. data/test/persisted_test.rb +30 -30
  20. data/test/rescheme_test.rb +22 -22
  21. data/test/skip_getter_test.rb +14 -14
  22. data/test/test_helper.rb +9 -6
  23. data/test/twin/builder_test.rb +3 -3
  24. data/test/twin/changed_test.rb +38 -38
  25. data/test/twin/coercion_test.rb +75 -38
  26. data/test/twin/collection_test.rb +48 -48
  27. data/test/twin/composition_test.rb +20 -20
  28. data/test/twin/default_test.rb +15 -15
  29. data/test/twin/expose_test.rb +15 -15
  30. data/test/twin/feature_test.rb +10 -10
  31. data/test/twin/from_collection_test.rb +4 -4
  32. data/test/twin/from_test.rb +3 -3
  33. data/test/twin/hash_test.rb +78 -31
  34. data/test/twin/inherit_test.rb +7 -7
  35. data/test/twin/inheritance_test.rb +6 -6
  36. data/test/twin/option_test.rb +1 -1
  37. data/test/twin/parent_test.rb +6 -6
  38. data/test/twin/property_processor_test.rb +5 -5
  39. data/test/twin/readable_test.rb +9 -9
  40. data/test/twin/save_test.rb +44 -44
  41. data/test/twin/setup_test.rb +25 -25
  42. data/test/twin/skip_unchanged_test.rb +6 -6
  43. data/test/twin/struct/coercion_test.rb +36 -0
  44. data/test/twin/struct_test.rb +41 -38
  45. data/test/twin/sync_option_test.rb +2 -2
  46. data/test/twin/sync_test.rb +29 -29
  47. data/test/twin/twin_test.rb +25 -15
  48. data/test/twin/unnest_test.rb +7 -7
  49. data/test/twin/virtual_test.rb +3 -3
  50. data/test/twin/writeable_test.rb +8 -8
  51. metadata +25 -57
  52. data/.travis.yml +0 -13
  53. data/gemfiles/Gemfile.rails-2.3 +0 -7
  54. data/gemfiles/Gemfile.rails-3.0 +0 -7
  55. data/gemfiles/Gemfile.rails-3.2 +0 -7
  56. data/gemfiles/Gemfile.rails-4.0 +0 -8
  57. data/gemfiles/Gemfile.rails-4.1 +0 -7
@@ -3,16 +3,15 @@ require "test_helper"
3
3
  require "disposable/twin/coercion"
4
4
 
5
5
  class CoercionTest < MiniTest::Spec
6
-
7
6
  class TwinWithSkipSetter < Disposable::Twin
8
7
  feature Coercion
9
8
  feature Setup::SkipSetter
10
9
 
11
10
  property :id
12
- property :released_at, type: Types::Form::DateTime
11
+ property :released_at, type: DRY_TYPES_CONSTANT::DateTime
13
12
 
14
13
  property :hit do
15
- property :length, type: Types::Coercible::Int
14
+ property :length, type: const_get("Types::Coercible::#{DRY_TYPES_INT_CONSTANT}")
16
15
  property :good, type: Types::Bool
17
16
  end
18
17
 
@@ -24,7 +23,6 @@ class CoercionTest < MiniTest::Spec
24
23
  end
25
24
 
26
25
  describe "with Setup::SkipSetter" do
27
-
28
26
  subject do
29
27
  TwinWithSkipSetter.new(album)
30
28
  end
@@ -39,9 +37,9 @@ class CoercionTest < MiniTest::Spec
39
37
  }
40
38
 
41
39
  it "NOT coerce values in setup" do
42
- subject.released_at.must_equal "31/03/1981"
43
- subject.hit.length.must_equal "312"
44
- subject.band.label.value.must_equal "9999.99"
40
+ expect(subject.released_at).must_equal "31/03/1981"
41
+ expect(subject.hit.length).must_equal "312"
42
+ expect(subject.band.label.value).must_equal "9999.99"
45
43
  end
46
44
 
47
45
 
@@ -51,17 +49,17 @@ class CoercionTest < MiniTest::Spec
51
49
  subject.hit.length = "312"
52
50
  subject.band.label.value = "9999.99"
53
51
 
54
- subject.released_at.must_be_kind_of DateTime
55
- subject.released_at.must_equal DateTime.parse("30/03/1981")
56
- subject.hit.length.must_equal 312
57
- subject.hit.good.must_equal nil
58
- subject.band.label.value.must_equal 9999.99
52
+ expect(subject.released_at).must_be_kind_of DateTime
53
+ expect(subject.released_at).must_equal DateTime.parse("30/03/1981")
54
+ expect(subject.hit.length).must_equal 312
55
+ expect(subject.hit.good).must_be_nil
56
+ expect(subject.band.label.value).must_equal 9999.99
59
57
  end
60
58
  end
61
59
 
62
60
  class TwinWithoutSkipSetter < Disposable::Twin
63
61
  feature Coercion
64
- property :id, type: Types::Coercible::Int
62
+ property :id, type: const_get("Types::Coercible::#{DRY_TYPES_INT_CONSTANT}")
65
63
  end
66
64
 
67
65
  describe "without Setup::SkipSetter" do
@@ -71,9 +69,9 @@ class CoercionTest < MiniTest::Spec
71
69
  end
72
70
 
73
71
  it "coerce values in setup and when using a setter" do
74
- subject.id.must_equal 1
72
+ expect(subject.id).must_equal 1
75
73
  subject.id = "2"
76
- subject.id.must_equal 2
74
+ expect(subject.id).must_equal 2
77
75
  end
78
76
  end
79
77
 
@@ -81,14 +79,21 @@ class CoercionTest < MiniTest::Spec
81
79
  feature Coercion
82
80
 
83
81
  property :date_of_birth,
84
- type: Types::Form::Date, nilify: true
82
+ type: DRY_TYPES_CONSTANT::Date, nilify: true
85
83
  property :date_of_death_by_unicorns,
86
- type: Types::Form::Nil | Types::Form::Date
87
- property :id, nilify: true
84
+ type: DRY_TYPES_CONSTANT::Nil | DRY_TYPES_CONSTANT::Date
85
+ property :id, type: const_get("Types::Coercible::#{DRY_TYPES_INT_CONSTANT}"), nilify: true
88
86
  end
89
87
 
90
- describe "with Nilify" do
88
+ class TwinWithoutTypeWithNilify < Disposable::Twin
89
+ feature Coercion
90
+
91
+ property :date_of_birth, nilify: true
92
+ property :date_of_death_by_unicorns, type: DRY_TYPES_CONSTANT::Nil | DRY_TYPES_CONSTANT::Date
93
+ property :id, type: const_get("Types::Coercible::#{DRY_TYPES_INT_CONSTANT}"), nilify: true
94
+ end
91
95
 
96
+ describe "with Nilify" do
92
97
  subject do
93
98
  TwinWithNilify.new(OpenStruct.new(date_of_birth: '1990-01-12',
94
99
  date_of_death_by_unicorns: '2037-02-18',
@@ -96,39 +101,70 @@ class CoercionTest < MiniTest::Spec
96
101
  end
97
102
 
98
103
  it "coerce values correctly" do
99
- subject.date_of_birth.must_equal Date.parse('1990-01-12')
100
- subject.date_of_death_by_unicorns.must_equal Date.parse('2037-02-18')
104
+ expect(subject.date_of_birth).must_equal Date.parse('1990-01-12')
105
+ expect(subject.date_of_death_by_unicorns).must_equal Date.parse('2037-02-18')
101
106
  end
102
107
 
103
108
  it "coerce empty values to nil when using option nilify: true" do
104
109
  subject.date_of_birth = ""
105
- subject.date_of_birth.must_equal nil
110
+ expect(subject.date_of_birth).must_be_nil
106
111
  end
107
112
 
108
113
  it "coerce empty values to nil when using dry-types | operator" do
109
114
  subject.date_of_death_by_unicorns = ""
110
- subject.date_of_death_by_unicorns.must_equal nil
115
+ expect(subject.date_of_death_by_unicorns).must_be_nil
111
116
  end
112
117
 
113
118
  it "converts blank string to nil, without :type option" do
114
119
  subject.id = ""
115
- subject.id.must_equal nil
120
+ expect(subject.id).must_be_nil
121
+ end
122
+ end
123
+
124
+ describe "without Type With Nilify" do
125
+ let(:date_of_birth) { '1990-01-12' }
126
+ subject do
127
+ TwinWithoutTypeWithNilify.new(
128
+ OpenStruct.new(
129
+ date_of_birth: date_of_birth,
130
+ date_of_death_by_unicorns: '2037-02-18',
131
+ id: 1
132
+ )
133
+ )
134
+ end
135
+
136
+ it 'raise error for new dry-types v - work as expected for older versions' do
137
+ if Disposable::Twin::Coercion::DRY_TYPES_VERSION >= Gem::Version.new("1.0")
138
+ assert_raises(Dry::Types::CoercionError) { subject.date_of_birth }
139
+ assert_raises(Dry::Types::CoercionError) { subject.date_of_death_by_unicorns }
140
+ else
141
+ expect(subject.date_of_birth).must_equal '1990-01-12'
142
+ expect(subject.date_of_death_by_unicorns).must_equal Date.parse('2037-02-18')
143
+ end
144
+ end
145
+
146
+ describe 'when passing nil' do
147
+ let(:date_of_birth) { '' }
148
+
149
+ it 'coerce values correctly' do
150
+ expect(subject.date_of_birth).must_be_nil
151
+ end
116
152
  end
117
153
  end
118
154
  end
119
155
 
120
156
  # this converts "" to nil and then breaks because it's strict.
121
- # Types::Strict::String.constructor(Dry::Types::Coercions::Form.method(:to_nil))
157
+ # Types::Strict::String.constructor(Dry::Types::Params.method(:to_nil))
122
158
 
123
159
  class CoercionTypingTest < MiniTest::Spec
124
160
  class Song < Disposable::Twin
125
161
  include Coercion
126
162
  include Setup::SkipSetter
127
163
 
128
- # property :title, type: Dry::Types::Strict::String.constructor(Dry::Types::Coercions::Form.method(:to_nil))
164
+ # property :title, type: Dry::Types::Strict::String.constructor(Dry::Types::Params.method(:to_nil))
129
165
  property :title, type: Types::Strict::String.optional # this is the behavior of the "DB" data twin. this is NOT the form.
130
166
 
131
- # property :name, type: Types::Form::String
167
+ # property :name, type: Types::Params::String
132
168
  end
133
169
 
134
170
  it do
@@ -137,13 +173,13 @@ class CoercionTypingTest < MiniTest::Spec
137
173
  # with type: Dry::Types::Strict::String
138
174
  # assert_raises(Dry::Types::ConstraintError) { twin.title = nil }
139
175
  twin.title = nil
140
- twin.title.must_be_nil
176
+ expect(twin.title).must_be_nil
141
177
 
142
178
  twin.title = "Yo"
143
- twin.title.must_equal "Yo"
179
+ expect(twin.title).must_equal "Yo"
144
180
 
145
181
  twin.title = ""
146
- twin.title.must_equal ""
182
+ expect(twin.title).must_equal ""
147
183
 
148
184
  assert_raises(Dry::Types::ConstraintError) { twin.title = :bla }
149
185
  assert_raises(Dry::Types::ConstraintError) { twin.title = 1 }
@@ -155,12 +191,13 @@ class CoercionTypingTest < MiniTest::Spec
155
191
  include Setup::SkipSetter
156
192
 
157
193
 
158
- # property :title, type: Dry::Types::Strict::String.constructor(Dry::Types::Coercions::Form.method(:to_nil))
159
- property :title, type: Types::Strict::String.optional.constructor(Dry::Types::Coercions::Form.method(:to_nil)) # this is the behavior of the "DB" data twin. this is NOT the form.
194
+ # property :title, type: Dry::Types::Strict::String.constructor(Dry::Types::Params.method(:to_nil))
195
+
196
+ property :title, type: DRY_TYPES_CONSTANT::Nil | Types::Strict::String # this is the behavior of the "DB" data twin. this is NOT the form.
160
197
 
161
- # property :name, type: Types::Form::String
198
+ # property :name, type: Types::Params::String
162
199
 
163
- property :enabled, type: Types::Form::Bool
200
+ property :enabled, type: DRY_TYPES_CONSTANT::Bool
164
201
  # property :enabled, Bool.constructor(:trim!)
165
202
  end
166
203
  it do
@@ -168,16 +205,16 @@ class CoercionTypingTest < MiniTest::Spec
168
205
 
169
206
  # assert_raises(Dry::Types::ConstraintError) { twin.title = nil } # in form, we either have a blank string or the key's not present at all.
170
207
  twin.title = nil
171
- twin.title.must_be_nil
208
+ expect(twin.title).must_be_nil
172
209
 
173
210
  twin.title = "" # nilify blank strings
174
- twin.title.must_be_nil
211
+ expect(twin.title).must_be_nil
175
212
 
176
213
  twin.title = "Yo"
177
- twin.title.must_equal "Yo"
214
+ expect(twin.title).must_equal "Yo"
178
215
 
179
216
  # twin.enabled = " TRUE"
180
- # twin.enabled.must_equal true
217
+ #expect(twin.enabled).must_equal true
181
218
  end
182
219
  end
183
220
 
@@ -33,9 +33,9 @@ class TwinCollectionTest < MiniTest::Spec
33
33
  it do
34
34
  twin = Twin::Album.new(album)
35
35
 
36
- twin.songs.size.must_equal 1
37
- twin.songs[0].title.must_equal "Broken"
38
- twin.songs.must_be_instance_of Disposable::Twin::Collection
36
+ expect(twin.songs.size).must_equal 1
37
+ expect(twin.songs[0].title).must_equal "Broken"
38
+ expect(twin.songs).must_be_instance_of Disposable::Twin::Collection
39
39
 
40
40
  end
41
41
  end
@@ -44,10 +44,10 @@ class TwinCollectionTest < MiniTest::Spec
44
44
  let (:album) { Model::Album.new(1, "The Rest Is Silence", [Model::Song.new(3), Model::Song.new(4)]) }
45
45
  let (:twin) { Twin::Album.new(album) }
46
46
 
47
- it { twin.songs.find_by(id: 1).must_equal nil }
48
- it { twin.songs.find_by(id: 3).must_equal twin.songs[0] }
49
- it { twin.songs.find_by(id: 4).must_equal twin.songs[1] }
50
- it { twin.songs.find_by(id: "4").must_equal twin.songs[1] }
47
+ it { expect(twin.songs.find_by(id: 1)).must_be_nil }
48
+ it { expect(twin.songs.find_by(id: 3)).must_equal twin.songs[0] }
49
+ it { expect(twin.songs.find_by(id: 4)).must_equal twin.songs[1] }
50
+ it { expect(twin.songs.find_by(id: "4")).must_equal twin.songs[1] }
51
51
  end
52
52
  end
53
53
 
@@ -92,31 +92,31 @@ class TwinCollectionActiveRecordTest < MiniTest::Spec
92
92
  twin.songs << song1 # assuming that we add AR model here.
93
93
  twin.songs << song2
94
94
 
95
- twin.songs.size.must_equal 2
95
+ expect(twin.songs.size).must_equal 2
96
96
 
97
- twin.songs[0].must_be_instance_of Twin::Song # twin wraps << added in twin.
98
- twin.songs[1].must_be_instance_of Twin::Song
97
+ expect(twin.songs[0]).must_be_instance_of Twin::Song # twin wraps << added in twin.
98
+ expect(twin.songs[1]).must_be_instance_of Twin::Song
99
99
 
100
- # twin.songs[0].persisted?.must_equal false
101
- twin.songs[0].send(:model).persisted?.must_equal false
102
- twin.songs[1].send(:model).persisted?.must_equal true
100
+ # expect(twin.songs[0].persisted?).must_equal false
101
+ expect(twin.songs[0].send(:model).persisted?).must_equal false
102
+ expect(twin.songs[1].send(:model).persisted?).must_equal true
103
103
 
104
- album.songs.size.must_equal 0 # nothing synced, yet.
104
+ expect(album.songs.size).must_equal 0 # nothing synced, yet.
105
105
 
106
106
  # sync: delete removed items, add new?
107
107
 
108
108
  # save
109
109
  twin.save
110
110
 
111
- album.persisted?.must_equal true
112
- album.name.must_equal "The Rest Is Silence"
111
+ expect(album.persisted?).must_equal true
112
+ expect(album.name).must_equal "The Rest Is Silence"
113
113
 
114
- album.songs.size.must_equal 2 # synced!
114
+ expect(album.songs.size).must_equal 2 # synced!
115
115
 
116
- album.songs[0].persisted?.must_equal true
117
- album.songs[1].persisted?.must_equal true
118
- album.songs[0].title.must_equal "Snorty Pacifical Rascal"
119
- album.songs[1].title.must_equal "At Any Cost"
116
+ expect(album.songs[0].persisted?).must_equal true
117
+ expect(album.songs[1].persisted?).must_equal true
118
+ expect(album.songs[0].title).must_equal "Snorty Pacifical Rascal"
119
+ expect(album.songs[1].title).must_equal "At Any Cost"
120
120
  end
121
121
 
122
122
  # test with adding to existing collection [song1] << song2
@@ -128,20 +128,20 @@ class TwinCollectionActiveRecordTest < MiniTest::Spec
128
128
  it do
129
129
  twin.songs.delete(twin.songs.first)
130
130
 
131
- twin.songs.size.must_equal 0
132
- album.songs.size.must_equal 1 # not synced, yet.
131
+ expect(twin.songs.size).must_equal 0
132
+ expect(album.songs.size).must_equal 1 # not synced, yet.
133
133
 
134
134
  twin.save
135
135
 
136
- twin.songs.size.must_equal 0
137
- album.songs.size.must_equal 0
138
- song1.persisted?.must_equal true
136
+ expect(twin.songs.size).must_equal 0
137
+ expect(album.songs.size).must_equal 0
138
+ expect(song1.persisted?).must_equal true
139
139
  end
140
140
 
141
141
  # non-existant delete.
142
142
  it do
143
143
  twin.songs.delete("non-existant") # won't delete anything.
144
- twin.songs.size.must_equal 1
144
+ expect(twin.songs.size).must_equal 1
145
145
  end
146
146
  end
147
147
 
@@ -151,14 +151,14 @@ class TwinCollectionActiveRecordTest < MiniTest::Spec
151
151
  it do
152
152
  twin.songs.destroy(twin.songs.first)
153
153
 
154
- twin.songs.size.must_equal 0
155
- album.songs.size.must_equal 1 # not synced, yet.
154
+ expect(twin.songs.size).must_equal 0
155
+ expect(album.songs.size).must_equal 1 # not synced, yet.
156
156
 
157
157
  twin.save
158
158
 
159
- twin.songs.size.must_equal 0
160
- album.songs.size.must_equal 0
161
- song1.persisted?.must_equal false
159
+ expect(twin.songs.size).must_equal 0
160
+ expect(album.songs.size).must_equal 0
161
+ expect(song1.persisted?).must_equal false
162
162
  end
163
163
  end
164
164
 
@@ -169,36 +169,36 @@ class TwinCollectionActiveRecordTest < MiniTest::Spec
169
169
  it do
170
170
  twin = Twin::Album.new(album)
171
171
 
172
- twin.songs.added.must_equal []
172
+ expect(twin.songs.added).must_equal []
173
173
  twin.songs << song2
174
- twin.songs.added.must_equal [twin.songs[1]]
175
- twin.songs.insert(2, song3 = Song.new)
176
- twin.songs.added.must_equal [twin.songs[1], twin.songs[2]]
174
+ expect(twin.songs.added).must_equal [twin.songs[1]]
175
+ twin.songs.insert(2, Song.new)
176
+ expect(twin.songs.added).must_equal [twin.songs[1], twin.songs[2]]
177
177
 
178
178
  # TODO: what to do if we override an item (insert)?
179
179
  end
180
180
  end
181
181
 
182
182
  describe "#deleted" do
183
- let (:album) { Album.create(name: "The Rest Is Silence", songs: [song1, song2, song3 = Song.new]) }
183
+ let (:album) { Album.create(name: "The Rest Is Silence", songs: [song1, song2, Song.new]) }
184
184
 
185
185
  it do
186
186
  twin = Twin::Album.new(album)
187
187
 
188
- twin.songs.deleted.must_equal []
188
+ expect(twin.songs.deleted).must_equal []
189
189
 
190
190
  twin.songs.delete(deleted1 = twin.songs[-1])
191
191
  twin.songs.delete(deleted2 = twin.songs[-1])
192
192
 
193
- twin.songs.must_equal [twin.songs[0]]
193
+ expect(twin.songs).must_equal [twin.songs[0]]
194
194
 
195
- twin.songs.deleted.must_equal [deleted1, deleted2]
195
+ expect(twin.songs.deleted).must_equal [deleted1, deleted2]
196
196
  end
197
197
 
198
198
  # non-existant delete.
199
199
  it do
200
200
  twin.songs.delete("non-existant") # won't delete anything.
201
- twin.songs.deleted.must_equal []
201
+ expect(twin.songs.deleted).must_equal []
202
202
  end
203
203
  end
204
204
  end
@@ -223,24 +223,24 @@ class CollectionUnitTest < MiniTest::Spec
223
223
 
224
224
  # #insert(index, model)
225
225
  it do
226
- collection.insert(0, Model::Album.new).must_be_instance_of Twin::Album
226
+ expect(collection.insert(0, Model::Album.new)).must_be_instance_of Twin::Album
227
227
  end
228
228
 
229
229
  # #append(model)
230
230
  it do
231
- collection.append(Model::Album.new).must_be_instance_of Twin::Album
232
- collection[0].must_be_instance_of Twin::Album
231
+ expect(collection.append(Model::Album.new)).must_be_instance_of Twin::Album
232
+ expect(collection[0]).must_be_instance_of Twin::Album
233
233
 
234
234
  # allows subsequent calls.
235
235
  collection.append(Model::Album.new)
236
- collection[1].must_be_instance_of Twin::Album
236
+ expect(collection[1]).must_be_instance_of Twin::Album
237
237
 
238
- collection.size.must_equal 2
238
+ expect(collection.size).must_equal 2
239
239
  end
240
240
 
241
241
  # #<<
242
242
  it do
243
- (collection << Model::Album.new).must_be_instance_of Array
244
- collection[0].must_be_instance_of Twin::Album
243
+ expect((collection << Model::Album.new)).must_be_instance_of Array
244
+ expect(collection[0]).must_be_instance_of Twin::Album
245
245
  end
246
246
  end
@@ -26,34 +26,34 @@ class TwinCompositionTest < MiniTest::Spec
26
26
  let (:request) { Request.new(song: song, requester: requester) }
27
27
 
28
28
  it do
29
- request.song_title.must_equal "Extraction"
30
- request.song_id.must_equal 2
31
- request.name.must_equal "Greg Howe"
32
- request.id.must_equal 1
29
+ expect(request.song_title).must_equal "Extraction"
30
+ expect(request.song_id).must_equal 2
31
+ expect(request.name).must_equal "Greg Howe"
32
+ expect(request.id).must_equal 1
33
33
 
34
34
  request.song_title = "Tease"
35
35
  request.name = "Wooten"
36
36
 
37
37
 
38
- request.song_title.must_equal "Tease"
39
- request.name.must_equal "Wooten"
38
+ expect(request.song_title).must_equal "Tease"
39
+ expect(request.name).must_equal "Wooten"
40
40
 
41
41
  # does not write to model.
42
- song.title.must_equal "Extraction"
43
- requester.name.must_equal "Greg Howe"
42
+ expect(song.title).must_equal "Extraction"
43
+ expect(requester.name).must_equal "Greg Howe"
44
44
 
45
45
 
46
46
  res = request.save
47
- res.must_equal true
47
+ expect(res).must_equal true
48
48
 
49
49
  # make sure models got synced and saved.
50
- song.id.must_equal 2
51
- song.title.must_equal "Tease"
52
- requester.id.must_equal 1
53
- requester.name.must_equal "Wooten"
50
+ expect(song.id).must_equal 2
51
+ expect(song.title).must_equal "Tease"
52
+ expect(requester.id).must_equal 1
53
+ expect(requester.name).must_equal "Wooten"
54
54
 
55
- song.saved?.must_equal true
56
- requester.saved?.must_equal true
55
+ expect(song.saved?).must_equal true
56
+ expect(requester.saved?).must_equal true
57
57
  end
58
58
 
59
59
  # save with block.
@@ -63,8 +63,8 @@ class TwinCompositionTest < MiniTest::Spec
63
63
  request.captcha = "Awesome!"
64
64
 
65
65
  # does not write to model.
66
- song.title.must_equal "Extraction"
67
- requester.name.must_equal "Greg Howe"
66
+ expect(song.title).must_equal "Extraction"
67
+ expect(requester.name).must_equal "Greg Howe"
68
68
 
69
69
 
70
70
  nested_hash = nil
@@ -72,13 +72,13 @@ class TwinCompositionTest < MiniTest::Spec
72
72
  nested_hash = hash
73
73
  end
74
74
 
75
- nested_hash.must_equal(:song=>{"title"=>"Tease", "id"=>2}, :requester=>{"name"=>"Wooten", "id"=>1, "captcha"=>"Awesome!"})
75
+ expect(nested_hash).must_equal(:song=>{"title"=>"Tease", "id"=>2}, :requester=>{"name"=>"Wooten", "id"=>1, "captcha"=>"Awesome!"})
76
76
  end
77
77
 
78
78
  # save with one unsaveable model.
79
79
  #save returns result.
80
80
  it do
81
81
  song.instance_eval { def save; false; end }
82
- request.save.must_equal false
82
+ expect(request.save).must_equal false
83
83
  end
84
- end
84
+ end