spec/spec_helper.rb in dm-rspec-0.0.2 vs spec/spec_helper.rb in dm-rspec-0.1.0
- old
+ new
@@ -40,10 +40,12 @@
include DataMapper::Resource
property :id, Serial
property :name, String
belongs_to :author
has n, :genres, :through => Resource
+ has n, :taggings
+ has n, :tags, :through => :taggings
validates_presence_of :name
validates_length_of :name, :min => 10
end
class Author
@@ -55,6 +57,19 @@
class Genre
include DataMapper::Resource
property :id, Serial
property :name, String
has n, :books, :through => Resource
+end
+
+class Tag
+ include DataMapper::Resource
+ property :id, Serial
+ has n, :taggings
+ has n, :books, :through => :taggings
+end
+
+class Tagging
+ include DataMapper::Resource
+ belongs_to :tag
+ belongs_to :book
end