Skip to content

Instantly share code, notes, and snippets.

@shingara
Created December 16, 2008 17:09
Show Gist options
  • Save shingara/36665 to your computer and use it in GitHub Desktop.
Save shingara/36665 to your computer and use it in GitHub Desktop.
User.fixture {{
:login => /\w+/.gen,
:email => "#{/\w+/.gen}.#{/\w+/.gen}@gmail.com",
:password => "tintinpouet",
}}
Function.fixture(:admin) {{
:name => 'Admin'
}}
admin = User.gen(:login => 'admin')
admin_function = Function.gen(:admin)
Project.fixture {{
:name => /\w+/.gen,
:description => (0..3).of { /[:paragraph:]/.generate }.join("\n"),
:tickets => (0..10).of {Ticket.make},
:members => [:user => admin, :function => admin_function]
}}
class Function
include DataMapper::Resource
property :id, Serial
property :name, String, :nullable => false, :unique => true
has n, :members
has n, :users, :through => :members
has n, :projects, :through => :members
end
class Member
include DataMapper::Resource
property :id, Serial
belongs_to :function
belongs_to :user
belongs_to :project
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment