To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.

Statistics Download as Zip
| Branch: | Tag: | Revision:

root / test / exemplars / user_exemplar.rb @ 442:753f1380d6bc

History | View | Annotate | Download (650 Bytes)

1
class User < Principal
2
  generator_for :login, :method => :next_login
3
  generator_for :mail, :method => :next_email
4
  generator_for :firstname, :method => :next_firstname
5
  generator_for :lastname, :method => :next_lastname
6
  
7
  def self.next_login
8
    @gen_login ||= 'user1'
9
    @gen_login.succ!
10
    @gen_login
11
  end
12
  
13
  def self.next_email
14
    @last_email ||= 'user1'
15
    @last_email.succ!
16
    "#{@last_email}@example.com"
17
  end
18

    
19
  def self.next_firstname
20
    @last_firstname ||= 'Bob'
21
    @last_firstname.succ!
22
    @last_firstname
23
  end
24

    
25
  def self.next_lastname
26
    @last_lastname ||= 'Doe'
27
    @last_lastname.succ!
28
    @last_lastname
29
  end
30
end