lib/test_dummy.rb in test_dummy-0.2.6 vs lib/test_dummy.rb in test_dummy-0.2.7
- old
+ new
@@ -122,10 +122,12 @@
# the dummy operation is completed. Returns a dummy model which has not
# been saved.
def build_dummy(with_attributes = nil)
load_dummy_declaration!
- model = new(TestDummy::Support.combine_attributes(scoped.scope_for_create, with_attributes))
+ build_scope = (method(:scoped).arity == 1) ? scoped(nil).scope(:create) : scoped.scope_for_create
+
+ model = new(TestDummy::Support.combine_attributes(build_scope, with_attributes))
yield(model) if (block_given?)
self.execute_dummy_operation(model, with_attributes)