Module: ModelMocker::ActiveRecordHook

Defined in:
lib/model_mocker.rb

Instance Method Summary collapse

Instance Method Details

#mock(params = {}) {|mock_model| ... } ⇒ Object

Create a new instance of the class, pass in creation params and then yield the ModelMocker instance so that methods can be called on it

Yields:

  • (mock_model)


37
38
39
40
41
# File 'lib/model_mocker.rb', line 37

def mock(params = {})
  mock_model = ModelMocker.new(self, params)
  yield(mock_model) if block_given?
  mock_model.instance
end