Module: TestDummy::TestHelper
- Defined in:
- lib/test_dummy/test_helper.rb
Instance Method Summary collapse
- #dummy(scope, options = { }) ⇒ Object (also: #a, #an, #one_of)
Instance Method Details
#dummy(scope, options = { }) ⇒ Object Also known as: a, an, one_of
2 3 4 5 6 7 8 9 10 11 12 13 |
# File 'lib/test_dummy/test_helper.rb', line 2 def dummy(scope, = { }) instance = scope.respond_to?(:build) ? scope.build() : scope.new() if (block_given?) yield(instance) end instance.dummy! instance.save! instance end |