test/twin/collection_test.rb in disposable-0.1.7 vs test/twin/collection_test.rb in disposable-0.1.8

- old
+ new

@@ -11,21 +11,21 @@ Album = Struct.new(:id, :name, :songs, :artist) end module Twin - class Album < Disposable::Twin - property :id # DISCUSS: needed for #save. - property :name - collection :songs, :twin => lambda { |*| Song } - end - class Song < Disposable::Twin property :id # DISCUSS: needed for #save. property :title property :album, :twin => Album end + + class Album < Disposable::Twin + property :id # DISCUSS: needed for #save. + property :name + collection :songs, :twin => lambda { |*| Song } + end end let (:song) { Model::Song.new(1, "Broken", nil) } let (:album) { Model::Album.new(1, "The Rest Is Silence", [song]) } @@ -44,22 +44,10 @@ require "disposable/twin/sync" require "disposable/twin/save" class TwinCollectionActiveRecordTest < MiniTest::Spec module Twin - class Album < Disposable::Twin - property :id # DISCUSS: needed for #save. - property :name - collection :songs, :twin => lambda { |*| Song } - property :artist, twin: lambda { |*| Artist } - - include Sync - include Save - include Setup - include Collection::Semantics - end - class Song < Disposable::Twin property :id # DISCUSS: needed for #save. property :title # property :persisted?, readonly: true # TODO: implement that!!!! for #sync @@ -67,9 +55,21 @@ include Sync include Save end class Artist < Disposable::Twin + end + + class Album < Disposable::Twin + property :id # DISCUSS: needed for #save. + property :name + collection :songs, :twin => lambda { |*| Song } + property :artist, twin: lambda { |*| Artist } + + include Sync + include Save + include Setup + include Collection::Semantics end end let (:album) { Album.create(name: "The Rest Is Silence") } let (:song1) { Song.new(title: "Snorty Pacifical Rascal") } # unsaved. \ No newline at end of file