Fix failure with minitest 5.0.7

Require minitest/mock in test where stub method is needed.

Apparently this was being "imported" by minitest pride plugin, which
previously required "minitest/autorun", that required "minitest/mock",
making the method available by chance.

It has been changed in minitest:
https://github.com/seattlerb/minitest/commit/595ce955c0d89575726d10fc18d2afd8f334bcbe

So we need to make sure we require what we really need where necessary.
ensure @model_class is initialized
don't depend on object state when reading fixture files
auto link hm:t fixture join tables like habtm
make the duplicate code more similar
reduce duplication somewhat
Use Ruby on Rails Coding Conventions for code examples in the guides

* Indent after private/protected
* Ruby >= 1.9 syntax for hashes
* Prefer method { do_stuff } instead of method{do_stuff} for single-line blocks.

[ci skip]
use polymorphic proxies to remove duplicate code
hm:t join tables may not have a primary key
Merge pull request #12155 from jetthoughts/reformat_guides_code_examples

Use Ruby on Rails Coding Conventions for code examples in the guides
Use MiniTest::Unit::TestCase instead of Minitest::Test

Since Rails 4.0.x is depending on Minitest 4.x, the constant won't be
available so the gist won't run.

[ci skip]
Fix fixtures regression that required table names to map to classes only, not class names
Typo in Changelog.
Merge pull request #12164 from rywall/patch-1

Typo in Changelog. [ci skip]
[ci skip] Change link name of Rails i18n wiki.

Actually it's Ruby i18n link.
Merge pull request #12166 from JuanitoFatas/doc-patch-1

[ci skip] Change link name of Rails i18n wiki.
Merge pull request #12157 from robin850/patch-9

Use MiniTest::Unit::TestCase instead of Minitest::Test  [ci skip]