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 / vendor / plugins / scenarios / spec / scenarios / people_scenario.rb
100644 26 lines (22 sloc) 0.666 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
class PeopleScenario < Scenario::Base
  
  def load
    create_person "John Long"
    create_person "Adam Williams"
  end
  
  helpers do
    def create_person(attributes = {})
      if attributes.kind_of?(String)
        first, last = attributes.split(/\s+/)
        attributes = { :first_name => first, :last_name => last }
      end
      attributes = person_params(attributes)
      create_record(:person, attributes[:first_name].strip.gsub(' ', '_').underscore.to_sym, attributes)
    end
    
    def person_params(attributes = {})
      attributes = {
        :first_name => "John",
        :last_name => "Q."
      }.update(attributes)
    end
  end
  
end