test/twin/twin_test.rb in disposable-0.4.6 vs test/twin/twin_test.rb in disposable-0.4.7

- old
+ new

@@ -33,21 +33,21 @@ describe "#initialize" do it do twin = Twin::Song.new(song) song.id = 2 # :from maps public name - twin.title.must_equal "Broken" # public: #record_name - twin.id.must_equal 1 + expect(twin.title).must_equal "Broken" # public: #record_name + expect(twin.id).must_equal 1 end # allows passing options. it do # override twin's value... - Twin::Song.new(song, :title => "Kenny").title.must_equal "Kenny" + expect(Twin::Song.new(song, :title => "Kenny").title).must_equal "Kenny" # .. but do not write to the model! - song.title.must_equal "Broken" + expect(song.title).must_equal "Broken" end end describe "setter" do let (:twin) { Twin::Song.new(song) } @@ -57,32 +57,32 @@ twin.id = 3 twin.title = "Lucky" twin.album = album # this is a model, not a twin. # updates twin - twin.id.must_equal 3 - twin.title.must_equal "Lucky" + expect(twin.id).must_equal 3 + expect(twin.title).must_equal "Lucky" # setter for nested property will twin value. twin.album.extend(Disposable::Comparable) - assert twin.album == Twin::Album.new(album) # FIXME: why does must_equal not call #== ? + assert twin.album == Twin::Album.new(album) # FIXME: why does) must_equal not call #== ? # setter for nested collection. # DOES NOT update model - song.id.must_equal 1 - song.title.must_equal "Broken" + expect(song.id).must_equal 1 + expect(song.title).must_equal "Broken" end describe "deleting" do it "allows overwriting nested twin with nil" do album = Model::Album.new(1, "Uncertain Terms", [], Model::Artist.new("Greg Howe")) twin = Twin::Album.new(album) - twin.artist.id.must_equal "Greg Howe" + expect(twin.artist.id).must_equal "Greg Howe" twin.artist = nil - twin.artist.must_be_nil + expect(twin.artist).must_be_nil end end # setters for twin properties return the twin, not the model # it do @@ -107,12 +107,12 @@ super(v+1) end end let (:model) { Model::Song.new(1, "A Tale That Wasn't Right") } - it { Song.new(model).title.must_equal "a tale that wasn't right" } - it { Song.new(model).id.must_equal 2 } + it { expect(Song.new(model).title).must_equal "a tale that wasn't right" } + it { expect(Song.new(model).id).must_equal 2 } end class TwinAsTest < MiniTest::Spec module Model @@ -146,10 +146,10 @@ property :format # Kernel#format end it do twin = Twin.new(Song.new("bla")) - twin.format.must_equal "bla" + expect(twin.format).must_equal "bla" twin.format = "blubb" end end class InvalidPropertyNameTest < Minitest::Spec