Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace :app do
- desc 'setup'
- task :setup => ['dm:db:automigrate', 'app:create_base_users', 'app:create_base_projects']
- task :create_base_users => :merb_env do
- User.create(
- :login => 'admin',
- :email => 'adam@wieck.com',
- :password => 'sekrit',
- :password_confirmation => 'sekrit',
- :active => true
- )
- end
- task :create_base_projects => [:merb_env] do
- User.fixture {{
- :login => /[:word:]/.gen,
- :email => /\w+@\w+\.(com|org|edu|co\.uk|com\.au)/.gen,
- :password => pwd = /\w+/.gen,
- :password_confirmation => pwd,
- :active => true
- }}
- Project.fixture {{
- :name => /\w+ Inc/.gen.capitalize,
- :description => /[:sentence:]{1,5}/.gen
- }}
- Ticket.fixture {{
- :title => /[:sentence:]/.gen,
- :description => /[:sentence:]{1,5}/.gen
- }}
- Comment.fixture {{
- :body => /[:sentence:]{1,5}/.gen,
- :user => User.all.entries.pick,
- :ticket => Ticket.all.entries.pick
- }}
- users = 20.of { User.gen }
- projects = 20.of { Project.gen }
- 50.of {
- Ticket.gen(
- :project => projects.pick,
- :users => (1..10).of { users.pick }.uniq,
- :comments => (1..10).of { Comment.gen }
- )
- }
- end
- end
Add Comment
Please, Sign In to add comment