test/twin/sync_test.rb in disposable-0.4.3 vs test/twin/sync_test.rb in disposable-0.4.4
- old
+ new
@@ -45,15 +45,15 @@
# this usually happens in Contract::Validate or in from_* in a representer
fill_out!(twin)
# not written to model, yet.
- album.name.must_equal nil
- album.songs[0].title.must_equal nil
- album.songs[1].title.must_equal nil
- album.songs[1].composer.name.must_equal nil
- album.artist.name.must_equal nil
+ album.name.must_be_nil
+ album.songs[0].title.must_be_nil
+ album.songs[1].title.must_be_nil
+ album.songs[1].composer.name.must_be_nil
+ album.artist.name.must_be_nil
twin.sync
album.name.must_equal "Live And Dangerous"
album.songs[0].must_be_instance_of Model::Song
@@ -80,13 +80,13 @@
twin.songs[0].title = "Southbound"
twin.songs[1].title = "The Boys Are Back In Town"
twin.songs[1].composer.name = "Lynott"
# not written to model, yet.
- album.name.must_equal nil
+ album.name.must_be_nil
album.songs.must_equal []
- album.artist.must_equal nil
+ album.artist.must_be_nil
twin.sync # this assigns a new collection via #songs=.
album.name.must_equal "Live And Dangerous"
album.songs[0].title.must_equal "Southbound"
@@ -108,14 +108,14 @@
end
nested_hash.must_equal({"name"=>"Live And Dangerous", "songs"=>[{"title"=>"Southbound", "composer"=>nil}, {"title"=>"The Boys Are Back In Town", "composer"=>{"name"=>"Lynott"}}], "artist"=>{"name"=>"Thin Lizzy"}})
# nothing written to model.
- album.name.must_equal nil
- album.songs[0].title.must_equal nil
- album.songs[1].title.must_equal nil
- album.songs[1].composer.name.must_equal nil
- album.artist.name.must_equal nil
+ album.name.must_be_nil
+ album.songs[0].title.must_be_nil
+ album.songs[1].title.must_be_nil
+ album.songs[1].composer.name.must_be_nil
+ album.artist.name.must_be_nil
end
describe "nil values" do
it "includes nil values, including nil collections" do
twin = Twin::Album.new(Model::Album.new(nil,