factory_girl_sequences 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
@@ -1,83 +1,43 @@
|
|
1
|
-
FactoryGirl
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
n
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
"
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
sequence :ip_address do |n|
|
41
|
-
"192.168.0.#{n%256}"
|
42
|
-
end
|
43
|
-
|
44
|
-
sequence :ip_subnet do |n|
|
45
|
-
"192.168.#{n%256}.0"
|
46
|
-
end
|
47
|
-
|
48
|
-
sequence :mac_address do |n|
|
49
|
-
"01:23:45:67:89:" + ("%02x" % "#{n%256}")
|
50
|
-
end
|
51
|
-
|
52
|
-
# == Post (article) ==
|
53
|
-
|
54
|
-
sequence :title do
|
55
|
-
"Title #{n}"
|
56
|
-
end
|
57
|
-
|
58
|
-
sequence :body, :aliases => [:description] do |n|
|
59
|
-
"body-#{n}"
|
60
|
-
end
|
61
|
-
|
62
|
-
sequence :slug do |n|
|
63
|
-
"slug-#{n}"
|
64
|
-
end
|
65
|
-
|
66
|
-
# == Other ==
|
67
|
-
|
68
|
-
sequence :domain do |n|
|
69
|
-
"example#{n}.com"
|
70
|
-
end
|
71
|
-
|
72
|
-
sequence :subdomain do |n|
|
73
|
-
"blog#{n}"
|
74
|
-
end
|
75
|
-
|
76
|
-
sequence :color do |n|
|
77
|
-
"%06d" % n
|
78
|
-
end
|
79
|
-
|
80
|
-
sequence :checksum do |n|
|
81
|
-
n
|
1
|
+
module FactoryGirl
|
2
|
+
|
3
|
+
def self.register_default_sequences
|
4
|
+
# basic types
|
5
|
+
register_sequence(Sequence.new(:integer) { |n| n })
|
6
|
+
register_sequence(Sequence.new(:string) { |n| "string-#{n}" })
|
7
|
+
register_sequence(Sequence.new(:date) { Date.today })
|
8
|
+
register_sequence(Sequence.new(:datetime) { Time.current })
|
9
|
+
register_sequence(Sequence.new(:boolean) { |n| [false, true][n%2] })
|
10
|
+
|
11
|
+
# personal
|
12
|
+
register_sequence(Sequence.new(:name, :aliases => [:login, :first_name, :last_name]) { |n| "name-#{n}" })
|
13
|
+
register_sequence(Sequence.new(:password) { |n| "password-#{n}" })
|
14
|
+
register_sequence(Sequence.new(:email) { |n| "person#{n}@example.com" })
|
15
|
+
|
16
|
+
# network
|
17
|
+
register_sequence(Sequence.new(:ip_address) { |n| "192.168.0.#{n%256}" })
|
18
|
+
register_sequence(Sequence.new(:ip_subnet) { |n| "192.168.#{n%256}.0" })
|
19
|
+
register_sequence(Sequence.new(:mac_address) { |n| "01:23:45:67:89:" + ("%02x" % "#{n%256}") })
|
20
|
+
|
21
|
+
# post (or article)
|
22
|
+
register_sequence(Sequence.new(:title) { |n| "Title #{n}" })
|
23
|
+
register_sequence(Sequence.new(:body, :aliases => [:description]) { |n| "body-#{n}" })
|
24
|
+
register_sequence(Sequence.new(:slug) { |n| "slug-#{n}" })
|
25
|
+
|
26
|
+
# other
|
27
|
+
register_sequence(Sequence.new(:domain) { |n| "example#{n}.com" })
|
28
|
+
register_sequence(Sequence.new(:subdomain) { |n| "blog#{n}" })
|
29
|
+
register_sequence(Sequence.new(:color) { |n| "%06d" % n })
|
30
|
+
register_sequence(Sequence.new(:checksum) { |n| n })
|
31
|
+
end
|
32
|
+
|
33
|
+
# FIXME [AK] Monkey-patching here. There should be another way around.
|
34
|
+
def self.reload
|
35
|
+
reset_configuration
|
36
|
+
register_default_strategies
|
37
|
+
register_default_callbacks
|
38
|
+
register_default_sequences
|
39
|
+
find_definitions
|
82
40
|
end
|
83
41
|
end
|
42
|
+
|
43
|
+
FactoryGirl.register_default_sequences
|
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.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -124,7 +124,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
124
124
|
version: '0'
|
125
125
|
segments:
|
126
126
|
- 0
|
127
|
-
hash: -
|
127
|
+
hash: -3035240991900668198
|
128
128
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
129
129
|
none: false
|
130
130
|
requirements:
|
@@ -133,7 +133,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
133
133
|
version: '0'
|
134
134
|
segments:
|
135
135
|
- 0
|
136
|
-
hash: -
|
136
|
+
hash: -3035240991900668198
|
137
137
|
requirements: []
|
138
138
|
rubyforge_project:
|
139
139
|
rubygems_version: 1.8.24
|