public
Description: Tracks is a GTD(TM) web application, built with Ruby on Rails
Homepage: http://www.rousette.org.uk/projects/
Clone URL: git://github.com/bsag/tracks.git
Click here to lend your support to: tracks and make a donation at www.pledgie.com !
tracks / spec / scenarios / todos_scenario.rb
100644 31 lines (28 sloc) 0.888 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
class TodosScenario < Scenario::Base
  uses :contexts, :projects, :users
 
  def load
    create_todo :bill,
      :description => 'Call Bill Gates to find out how much he makes per day',
      :user => :sean,
      :context => :call,
      :project => :make_more_money
    create_todo :bank,
      :description => 'Call my bank',
      :user => :sean,
      :context => :call,
      :project => :make_more_money
  end
 
  def create_todo(identifier, options={})
    context = options.delete(:context)
    project = options.delete(:project)
    user = options.delete(:user)
    attributes = {
      :state => 'active',
      :created_at => 1.week.ago,
      :context_id => context_id(context),
      :project_id => project_id(project),
      :user_id => user_id(user)
    }.merge(options)
    create_model :todo, identifier, attributes
  end
end