Skip to content
Browse files

updated Getting Started with docu on new aliased sequence functionality

  • Loading branch information...
1 parent 178a7ab commit f013335826bab7486ce8174958a797e27cd956de @kristianmandrup kristianmandrup committed with joshuaclayton
Showing with 29 additions and 0 deletions.
  1. +29 −0 GETTING_STARTED.md
View
29 GETTING_STARTED.md
@@ -401,6 +401,35 @@ factory :post do
end
```
+Sequences can also have aliases. The sequence aliases share the same counter:
+
+```ruby
+factory :user do
+ sequence(:email, 1000, :aliases => [:sender, :receiver]) {|n| "person#{n}@example.com" }
+end
+
+# will increase value counter for :email which is shared by :sender and :receiver
+FactoryGirl.next(:sender)
+```
+
+Define aliases and use default value (=1) for the counter
+
+```ruby
+factory :user do
+ sequence(:email, :aliases => [:sender, :receiver]) {|n| "person#{n}@example.com" }
+end
+```
+
+Setting the value using the :value option:
+
+```ruby
+factory :user do
+ sequence(:email, :value => 'b', :aliases => [:sender, :receiver]) {|n| "person#{n}@example.com" }
+end
+```
+
+The value just needs to support the `#next` method. Here the next value will be 'b'.
+
Traits
------

0 comments on commit f013335

Please sign in to comment.
Something went wrong with that request. Please try again.