rspec-rails

https://github.com/rspec/rspec-rails

Ruby

RSpec for Rails 5+

Rspec::Generators::ScaffoldGenerator#mock_file_name

Returns the name of the mock. For example, if the file name is user,
it returns mock_user.

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

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

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

Source | Google | Stack overflow

Edit

git clone [email protected]:rspec/rspec-rails.git

cd rspec-rails

open lib/generators/rspec/scaffold/scaffold_generator.rb

Contribute

# Make a new branch

git checkout -b -your-name--update-docs-Rspec--Generators--ScaffoldGenerator-mock_file_name-for-pr


# Commit to git

git add lib/generators/rspec/scaffold/scaffold_generator.rbgit commit -m "better docs for Rspec::Generators::ScaffoldGenerator#mock_file_name"


# Open pull request

gem install hub # on a mac you can `brew install hub`

hub fork

git push <your name> -your-name--update-docs-Rspec--Generators--ScaffoldGenerator-mock_file_name-for-pr

hub pull-request


# Celebrate!