test_dummy 0.2.2 → 0.2.3

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.
Files changed (4) hide show
  1. data/VERSION +1 -1
  2. data/lib/test_dummy.rb +18 -12
  3. data/test_dummy.gemspec +1 -1
  4. metadata +2 -2
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.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
- unless (defined?(@_dummy_module))
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
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{test_dummy}
8
- s.version = "0.2.2"
8
+ s.version = "0.2.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["tadman"]
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 2
8
- - 2
9
- version: 0.2.2
8
+ - 3
9
+ version: 0.2.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - tadman