fabrication 1.4.0 → 1.4.1

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -9,7 +9,7 @@ end
9
9
 
10
10
  require 'cucumber/rake/task'
11
11
  Cucumber::Rake::Task.new(:cucumber) do |t|
12
- t.cucumber_opts = "--format Cucumber::Formatter::Fuubar --tags ~@wip"
12
+ t.cucumber_opts = "--format progress --tags ~@wip"
13
13
  end
14
14
 
15
15
  RSpec::Core::RakeTask.new(:turnip) do |spec|
@@ -124,7 +124,7 @@ class Fabrication::Schematic::Definition
124
124
  (defined?(HashWithIndifferentAccess) ? HashWithIndifferentAccess.new : {}).tap do |hash|
125
125
  attributes.map do |attribute|
126
126
  value = object.send(attribute.name)
127
- if value.respond_to? :id
127
+ if value && value.respond_to?(:id)
128
128
  hash["#{attribute.name}_id"] = value.id
129
129
  else
130
130
  hash[attribute.name] = value
@@ -12,12 +12,18 @@ module Fabrication
12
12
  #
13
13
  #
14
14
  module Make
15
- def make(overrides = {}, &block)
16
- Fabricate.build(name.underscore.to_sym, overrides, &block)
15
+ def make(*args, &block)
16
+ overrides = args.extract_options!
17
+ klass = name.underscore.to_sym
18
+ fabricator_name = args.first.is_a?(Symbol) ? "#{klass}_#{args.first}" : klass
19
+ Fabricate.build(fabricator_name, overrides, &block)
17
20
  end
18
21
 
19
- def make!(overrides = {}, &block)
20
- Fabricate(name.underscore.to_sym, overrides, &block)
22
+ def make!(*args, &block)
23
+ overrides = args.extract_options!
24
+ klass = name.underscore.to_sym
25
+ fabricator_name = args.first.is_a?(Symbol) ? "#{klass}_#{args.first}" : klass
26
+ Fabricate(fabricator_name, overrides, &block)
21
27
  end
22
28
  end
23
29
  end
@@ -1,3 +1,3 @@
1
1
  module Fabrication
2
- VERSION = '1.4.0'
2
+ VERSION = '1.4.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fabrication
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.4.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-05-05 00:00:00.000000000 Z
12
+ date: 2012-06-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord
16
- requirement: &70248489649880 !ruby/object:Gem::Requirement
16
+ requirement: &70131616319860 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70248489649880
24
+ version_requirements: *70131616319860
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: bson_ext
27
- requirement: &70248489648640 !ruby/object:Gem::Requirement
27
+ requirement: &70131616319440 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70248489648640
35
+ version_requirements: *70131616319440
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: cucumber
38
- requirement: &70248489647020 !ruby/object:Gem::Requirement
38
+ requirement: &70131616319020 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70248489647020
46
+ version_requirements: *70131616319020
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: sqlite3
49
- requirement: &70248489646320 !ruby/object:Gem::Requirement
49
+ requirement: &70131616318600 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70248489646320
57
+ version_requirements: *70131616318600
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: dm-active_model
60
- requirement: &70248489645760 !ruby/object:Gem::Requirement
60
+ requirement: &70131616318180 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *70248489645760
68
+ version_requirements: *70131616318180
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: dm-core
71
- requirement: &70248489644760 !ruby/object:Gem::Requirement
71
+ requirement: &70131616317760 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *70248489644760
79
+ version_requirements: *70131616317760
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: dm-migrations
82
- requirement: &70248489643740 !ruby/object:Gem::Requirement
82
+ requirement: &70131616317340 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: '0'
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *70248489643740
90
+ version_requirements: *70131616317340
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: dm-sqlite-adapter
93
- requirement: &70248489629400 !ruby/object:Gem::Requirement
93
+ requirement: &70131616316920 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ! '>='
@@ -98,10 +98,10 @@ dependencies:
98
98
  version: '0'
99
99
  type: :development
100
100
  prerelease: false
101
- version_requirements: *70248489629400
101
+ version_requirements: *70131616316920
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: turnip
104
- requirement: &70248489628020 !ruby/object:Gem::Requirement
104
+ requirement: &70131615272400 !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements:
107
107
  - - ! '>='
@@ -109,10 +109,10 @@ dependencies:
109
109
  version: '0.3'
110
110
  type: :development
111
111
  prerelease: false
112
- version_requirements: *70248489628020
112
+ version_requirements: *70131615272400
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: ffaker
115
- requirement: &70248489627440 !ruby/object:Gem::Requirement
115
+ requirement: &70131615269340 !ruby/object:Gem::Requirement
116
116
  none: false
117
117
  requirements:
118
118
  - - ! '>='
@@ -120,32 +120,10 @@ dependencies:
120
120
  version: '0'
121
121
  type: :development
122
122
  prerelease: false
123
- version_requirements: *70248489627440
124
- - !ruby/object:Gem::Dependency
125
- name: fuubar
126
- requirement: &70248489626520 !ruby/object:Gem::Requirement
127
- none: false
128
- requirements:
129
- - - ! '>='
130
- - !ruby/object:Gem::Version
131
- version: '0'
132
- type: :development
133
- prerelease: false
134
- version_requirements: *70248489626520
135
- - !ruby/object:Gem::Dependency
136
- name: fuubar-cucumber
137
- requirement: &70248489626020 !ruby/object:Gem::Requirement
138
- none: false
139
- requirements:
140
- - - ! '>='
141
- - !ruby/object:Gem::Version
142
- version: '0'
143
- type: :development
144
- prerelease: false
145
- version_requirements: *70248489626020
123
+ version_requirements: *70131615269340
146
124
  - !ruby/object:Gem::Dependency
147
125
  name: mongoid
148
- requirement: &70248489625400 !ruby/object:Gem::Requirement
126
+ requirement: &70131615264260 !ruby/object:Gem::Requirement
149
127
  none: false
150
128
  requirements:
151
129
  - - ! '>='
@@ -153,10 +131,10 @@ dependencies:
153
131
  version: '0'
154
132
  type: :development
155
133
  prerelease: false
156
- version_requirements: *70248489625400
134
+ version_requirements: *70131615264260
157
135
  - !ruby/object:Gem::Dependency
158
136
  name: pry
159
- requirement: &70248489624900 !ruby/object:Gem::Requirement
137
+ requirement: &70131616346200 !ruby/object:Gem::Requirement
160
138
  none: false
161
139
  requirements:
162
140
  - - ! '>='
@@ -164,10 +142,10 @@ dependencies:
164
142
  version: '0'
165
143
  type: :development
166
144
  prerelease: false
167
- version_requirements: *70248489624900
145
+ version_requirements: *70131616346200
168
146
  - !ruby/object:Gem::Dependency
169
147
  name: rake
170
- requirement: &70248489624300 !ruby/object:Gem::Requirement
148
+ requirement: &70131616345780 !ruby/object:Gem::Requirement
171
149
  none: false
172
150
  requirements:
173
151
  - - ! '>='
@@ -175,10 +153,10 @@ dependencies:
175
153
  version: '0'
176
154
  type: :development
177
155
  prerelease: false
178
- version_requirements: *70248489624300
156
+ version_requirements: *70131616345780
179
157
  - !ruby/object:Gem::Dependency
180
158
  name: rspec
181
- requirement: &70248489623680 !ruby/object:Gem::Requirement
159
+ requirement: &70131616345360 !ruby/object:Gem::Requirement
182
160
  none: false
183
161
  requirements:
184
162
  - - ! '>='
@@ -186,10 +164,10 @@ dependencies:
186
164
  version: '0'
187
165
  type: :development
188
166
  prerelease: false
189
- version_requirements: *70248489623680
167
+ version_requirements: *70131616345360
190
168
  - !ruby/object:Gem::Dependency
191
169
  name: sequel
192
- requirement: &70248489623160 !ruby/object:Gem::Requirement
170
+ requirement: &70131616344940 !ruby/object:Gem::Requirement
193
171
  none: false
194
172
  requirements:
195
173
  - - ! '>='
@@ -197,7 +175,7 @@ dependencies:
197
175
  version: '0'
198
176
  type: :development
199
177
  prerelease: false
200
- version_requirements: *70248489623160
178
+ version_requirements: *70131616344940
201
179
  description: Fabrication is an object generation framework for ActiveRecord, Mongoid,
202
180
  and Sequel. It has a sensible syntax and lazily generates ActiveRecord associations!
203
181
  email: