factory_seed 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -53,6 +53,19 @@ You can define the associations by providing a hash.
53
53
  @user = _1_user
54
54
  _10_comments(:user => @user)
55
55
 
56
+ In fact, you can set any attribute by providing this hash.
57
+
58
+ @user = _1_user(:username => "johndoe")
59
+
60
+ If you need to set attributes from multiple factories, the best approach is to break into several calls.
61
+
62
+ @user = _1_user(:username => "johndoe")
63
+ @comments = _10_messages(:user => @user, :subject => "Welcome to our App")
64
+
65
+ The +seed+ method can receive a hash as well.
66
+
67
+ @user = seed("1 user", :username => "johndoe")
68
+
56
69
  = Using with Test::Unit
57
70
 
58
71
  Just include the +Seed+ module.
@@ -0,0 +1 @@
1
+ require "seed"
@@ -2,7 +2,7 @@ module Seed
2
2
  module Version # :nodoc: all
3
3
  MAJOR = 0
4
4
  MINOR = 1
5
- PATCH = 0
5
+ PATCH = 1
6
6
  STRING = "#{MAJOR}.#{MINOR}.#{PATCH}"
7
7
  end
8
8
  end
@@ -107,4 +107,10 @@ class SeedTest < Test::Unit::TestCase
107
107
  assert_kind_of User, @user
108
108
  assert @user.admin?
109
109
  end
110
+
111
+ def test_set_other_attributes
112
+ @user = _1_user(:username => "johnny")
113
+
114
+ assert_equal "johnny", @user.username
115
+ end
110
116
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 0
9
- version: 0.1.0
8
+ - 1
9
+ version: 0.1.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Nando Vieira
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-03-22 00:00:00 -03:00
17
+ date: 2010-03-29 00:00:00 -03:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -39,6 +39,7 @@ extra_rdoc_files:
39
39
  - README.rdoc
40
40
  files:
41
41
  - README.rdoc
42
+ - lib/factory_seed.rb
42
43
  - lib/seed.rb
43
44
  - lib/seed/version.rb
44
45
  - test/resources/factories.rb