class Rspec::Generators::ScaffoldGenerator

def mock_file_name(hash=nil)


called, it will be the one used.
If another ORM is being used and another method instead of save is

#=> mock_user(:save => true)
mock_file_name(:save => true)

value as response. So, for ActiveRecord and file name "User":
If a hash is given, it uses the hash key as the ORM method and the

it returns mock_user.
Returns the name of the mock. For example, if the file name is user,
def mock_file_name(hash=nil)
  if hash
    method, and_return = hash.to_a.first
    method = orm_instance.send(method).split('.').last.gsub(/\(.*?\)/, '')
    "mock_#{file_name}(:#{method} => #{and_return})"
  else
    "mock_#{file_name}"
  end
end