test_dummy 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/test_dummy.rb +18 -12
- data/test_dummy.gemspec +1 -1
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.3
|
data/lib/test_dummy.rb
CHANGED
@@ -122,18 +122,7 @@ module TestDummy
|
|
122
122
|
# the dummy operation is completed. Returns a dummy model which has not
|
123
123
|
# been saved.
|
124
124
|
def build_dummy(with_attributes = nil)
|
125
|
-
|
126
|
-
@_dummy_module =
|
127
|
-
begin
|
128
|
-
dummy_path = File.expand_path("test/dummy/#{name.underscore}.rb", Rails.root)
|
129
|
-
|
130
|
-
if (File.exist?(dummy_path))
|
131
|
-
require dummy_path
|
132
|
-
end
|
133
|
-
rescue LoadError
|
134
|
-
false
|
135
|
-
end
|
136
|
-
end
|
125
|
+
load_dummy_declaration!
|
137
126
|
|
138
127
|
model = new(TestDummy::Support.combine_attributes(scoped.scope_for_create, with_attributes))
|
139
128
|
|
@@ -203,6 +192,8 @@ module TestDummy
|
|
203
192
|
# This performs the dummy operation on a model with an optional set
|
204
193
|
# of parameters.
|
205
194
|
def execute_dummy_operation(model, with_attributes = nil)
|
195
|
+
load_dummy_declaration!
|
196
|
+
|
206
197
|
return model unless (@test_dummy_order)
|
207
198
|
|
208
199
|
@test_dummy_order.each do |name|
|
@@ -221,6 +212,21 @@ module TestDummy
|
|
221
212
|
end
|
222
213
|
|
223
214
|
protected
|
215
|
+
def load_dummy_declaration!
|
216
|
+
return if (defined?(@_dummy_module))
|
217
|
+
|
218
|
+
@_dummy_module =
|
219
|
+
begin
|
220
|
+
dummy_path = File.expand_path("test/dummy/#{name.underscore}.rb", Rails.root)
|
221
|
+
|
222
|
+
if (File.exist?(dummy_path))
|
223
|
+
require dummy_path
|
224
|
+
end
|
225
|
+
rescue LoadError
|
226
|
+
false
|
227
|
+
end
|
228
|
+
end
|
229
|
+
|
224
230
|
def dummy_method_call(model, with_attributes, block)
|
225
231
|
case (block.arity)
|
226
232
|
when 2, -1
|
data/test_dummy.gemspec
CHANGED