factory_girl_sequences 0.0.4 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +6 -0
- data/README.md +63 -38
- data/lib/factory_girl_sequences/sequences.rb +4 -4
- data/lib/factory_girl_sequences/version.rb +1 -1
- metadata +4 -4
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -3,11 +3,16 @@
|
|
3
3
|
Collection of useful [FactoryGirl](https://github.com/thoughtbot/factory_girl)
|
4
4
|
sequences.
|
5
5
|
|
6
|
+
**Important**
|
7
|
+
|
8
|
+
This minigem provides only a basic set of standard data. If you need more complex
|
9
|
+
data in your application (e.g. US postal code or address), I recommend [Faker](http://github.com/stympy/faker).
|
10
|
+
|
6
11
|
## Installation
|
7
12
|
|
8
13
|
Add this line to your application's Gemfile:
|
9
14
|
|
10
|
-
gem 'factory_girl_sequences'
|
15
|
+
gem 'factory_girl_sequences', :group => :test
|
11
16
|
|
12
17
|
Or install it yourself as:
|
13
18
|
|
@@ -19,97 +24,116 @@ Or install it yourself as:
|
|
19
24
|
<tr>
|
20
25
|
<th>Name</th>
|
21
26
|
<th>Aliases</th>
|
27
|
+
<th>DataType</th>
|
22
28
|
<th>Example</th>
|
23
29
|
</tr>
|
24
30
|
<tr>
|
25
|
-
<td
|
26
|
-
<td
|
31
|
+
<td>integer</td>
|
32
|
+
<td>checksum</td>
|
33
|
+
<td>Integer</td>
|
27
34
|
<td>1</td>
|
28
35
|
</tr>
|
29
36
|
<tr>
|
30
|
-
<td
|
37
|
+
<td>string</td>
|
31
38
|
<td>-</td>
|
32
|
-
<td>
|
39
|
+
<td>String</td>
|
40
|
+
<td>string-1</td>
|
33
41
|
</tr>
|
34
42
|
<tr>
|
35
|
-
<td
|
43
|
+
<td>date</td>
|
36
44
|
<td>-</td>
|
45
|
+
<td>Date</td>
|
37
46
|
<td>Sat, 20 Oct 2012</td>
|
38
47
|
</tr>
|
39
48
|
<tr>
|
40
|
-
<td
|
49
|
+
<td>datetime</td>
|
41
50
|
<td>-</td>
|
51
|
+
<td>Time</td>
|
42
52
|
<td>Sat, 20 Oct 2012 16:38:59 MSK +04:00</td>
|
43
53
|
</tr>
|
44
54
|
<tr>
|
45
|
-
<td
|
55
|
+
<td>boolean</td>
|
46
56
|
<td>-</td>
|
57
|
+
<td>Boolean</td>
|
47
58
|
<td>true</td>
|
48
59
|
</tr>
|
49
60
|
<tr>
|
50
|
-
<td
|
51
|
-
<td
|
52
|
-
<td>
|
61
|
+
<td>name</td>
|
62
|
+
<td>login, first_name, last_name</td>
|
63
|
+
<td>String</td>
|
64
|
+
<td>name-1</td>
|
53
65
|
</tr>
|
54
66
|
<tr>
|
55
|
-
<td
|
67
|
+
<td>password</td>
|
56
68
|
<td>-</td>
|
57
|
-
<td>
|
69
|
+
<td>String</td>
|
70
|
+
<td>password-1</td>
|
58
71
|
</tr>
|
59
72
|
<tr>
|
60
|
-
<td
|
73
|
+
<td>email</td>
|
61
74
|
<td>-</td>
|
62
|
-
<td>
|
75
|
+
<td>String</td>
|
76
|
+
<td>person1@example.com</td>
|
63
77
|
</tr>
|
64
78
|
<tr>
|
65
|
-
<td
|
79
|
+
<td>ip_address</td>
|
66
80
|
<td>-</td>
|
67
|
-
<td>
|
81
|
+
<td>String</td>
|
82
|
+
<td>192.168.0.1</td>
|
68
83
|
</tr>
|
69
84
|
<tr>
|
70
|
-
<td
|
85
|
+
<td>ip_subnet</td>
|
71
86
|
<td>-</td>
|
72
|
-
<td>
|
87
|
+
<td>String</td>
|
88
|
+
<td>192.168.10.0</td>
|
73
89
|
</tr>
|
74
90
|
<tr>
|
75
|
-
<td
|
91
|
+
<td>mac_address</td>
|
76
92
|
<td>-</td>
|
77
|
-
<td>
|
93
|
+
<td>String</td>
|
94
|
+
<td>01:23:45:67:89:01</td>
|
78
95
|
</tr>
|
79
96
|
<tr>
|
80
|
-
<td
|
97
|
+
<td>title</td>
|
81
98
|
<td>-</td>
|
82
|
-
<td>
|
99
|
+
<td>String</td>
|
100
|
+
<td>Title 1</td>
|
83
101
|
</tr>
|
84
102
|
<tr>
|
85
|
-
<td
|
86
|
-
<td
|
87
|
-
<td>
|
103
|
+
<td>body</td>
|
104
|
+
<td>description</td>
|
105
|
+
<td>String</td>
|
106
|
+
<td>body-1</td>
|
88
107
|
</tr>
|
89
108
|
<tr>
|
90
|
-
<td
|
109
|
+
<td>slug</td>
|
91
110
|
<td>-</td>
|
92
|
-
<td>
|
111
|
+
<td>String</td>
|
112
|
+
<td>slug-1</td>
|
93
113
|
</tr>
|
94
114
|
<tr>
|
95
|
-
<td
|
115
|
+
<td>url</td>
|
96
116
|
<td>-</td>
|
97
|
-
<td>
|
117
|
+
<td>String</td>
|
118
|
+
<td>http://example1.com</td>
|
98
119
|
</tr>
|
99
120
|
<tr>
|
100
|
-
<td
|
121
|
+
<td>domain</td>
|
101
122
|
<td>-</td>
|
102
|
-
<td>
|
123
|
+
<td>String</td>
|
124
|
+
<td>example1.com</td>
|
103
125
|
</tr>
|
104
126
|
<tr>
|
105
|
-
<td
|
127
|
+
<td>subdomain</td>
|
106
128
|
<td>-</td>
|
107
|
-
<td>
|
129
|
+
<td>String</td>
|
130
|
+
<td>blog1</td>
|
108
131
|
</tr>
|
109
132
|
<tr>
|
110
|
-
<td
|
133
|
+
<td>color</td>
|
111
134
|
<td>-</td>
|
112
|
-
<td>
|
135
|
+
<td>String</td>
|
136
|
+
<td>333333</td>
|
113
137
|
</tr>
|
114
138
|
</table>
|
115
139
|
|
@@ -154,5 +178,6 @@ project's `test(spec)/factories/sequences.rb` file and modify it.
|
|
154
178
|
1. Fork it
|
155
179
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
156
180
|
3. Commit your changes (`git commit -am 'Added some feature'`)
|
157
|
-
4.
|
158
|
-
5.
|
181
|
+
4. Test your changes by running `bundle exec rake cucumber` command
|
182
|
+
5. Push to the branch (`git push origin my-new-feature`)
|
183
|
+
6. Create new Pull Request
|
@@ -2,14 +2,14 @@ module FactoryGirl
|
|
2
2
|
|
3
3
|
def self.register_default_sequences
|
4
4
|
# basic types
|
5
|
-
register_sequence(Sequence.new(:integer) { |n| n })
|
5
|
+
register_sequence(Sequence.new(:integer, :aliases => [:checksum]) { |n| n })
|
6
6
|
register_sequence(Sequence.new(:string) { |n| "string-#{n}" })
|
7
7
|
register_sequence(Sequence.new(:date) { Date.today })
|
8
8
|
register_sequence(Sequence.new(:datetime) { Time.current })
|
9
9
|
register_sequence(Sequence.new(:boolean) { |n| [false, true][n%2] })
|
10
10
|
|
11
11
|
# personal
|
12
|
-
register_sequence(Sequence.new(:name, :aliases => [:login, :first_name, :last_name]) { |n| "name-#{n}" })
|
12
|
+
register_sequence(Sequence.new(:name, :aliases => [:login, :username, :first_name, :last_name]) { |n| "name-#{n}" })
|
13
13
|
register_sequence(Sequence.new(:password) { |n| "password-#{n}" })
|
14
14
|
register_sequence(Sequence.new(:email) { |n| "person#{n}@example.com" })
|
15
15
|
|
@@ -21,13 +21,13 @@ module FactoryGirl
|
|
21
21
|
# post (or article)
|
22
22
|
register_sequence(Sequence.new(:title) { |n| "Title #{n}" })
|
23
23
|
register_sequence(Sequence.new(:body, :aliases => [:description]) { |n| "body-#{n}" })
|
24
|
-
register_sequence(Sequence.new(:slug) { |n| "
|
24
|
+
register_sequence(Sequence.new(:slug) { |n| "slug_#{n}" })
|
25
25
|
|
26
26
|
# other
|
27
|
+
register_sequence(Sequence.new(:url) { |n| "http://example#{n}.com" })
|
27
28
|
register_sequence(Sequence.new(:domain) { |n| "example#{n}.com" })
|
28
29
|
register_sequence(Sequence.new(:subdomain) { |n| "blog#{n}" })
|
29
30
|
register_sequence(Sequence.new(:color) { |n| "%06d" % n })
|
30
|
-
register_sequence(Sequence.new(:checksum) { |n| n })
|
31
31
|
end
|
32
32
|
|
33
33
|
# FIXME [AK] Monkey-patching here. There should be another way around.
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: factory_girl_sequences
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-10-
|
12
|
+
date: 2012-10-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: factory_girl
|
@@ -136,7 +136,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
136
136
|
version: '0'
|
137
137
|
segments:
|
138
138
|
- 0
|
139
|
-
hash:
|
139
|
+
hash: 2178118802469513978
|
140
140
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
141
141
|
none: false
|
142
142
|
requirements:
|
@@ -145,7 +145,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
145
145
|
version: '0'
|
146
146
|
segments:
|
147
147
|
- 0
|
148
|
-
hash:
|
148
|
+
hash: 2178118802469513978
|
149
149
|
requirements: []
|
150
150
|
rubyforge_project:
|
151
151
|
rubygems_version: 1.8.24
|