Isolate railties Generators Tests

With this change jruby should pass all of the railties tests.
Merge pull request #11726 from atambo/isolate_generator_tests

Isolate railties Generators Tests
Revert "Isolate railties Generators Tests"

This fixes railties tests in JRuby but break it in MRI
This reverts commit fea99276c7024f183bf72a16ad9f36af4bae1d42.
`as_json` correctly detecting circular references

The way `ActiveSupport::JSON::Encoding::Encoder` was setup didn't
account for certain cases for circular reference detection, besides
having incorrect arguments for certain methods (rails/rails#11460). The
way the encoder works has been rewritten to account for this cases and
fix the incorrect arguments.

To fix the issues described in rails/rails#11460, `as_json` had to be
standarized across Rails to return a JSON Ready object, which only
contains primitives that can be directly mapped to JSON primitives
(`Array`, `Hash`, `Numeric`, `String`, `TrueClass`,`FalseClass`,
`NilClass`). This meant rewriting some tests that failed to comply with
this requirement, among other minor changes in `ActiveModel` and
`ActionPack`.

Fixes rails/rails#11460