From a purist pov, I would try to implement this by defining, then un-defining the module. This way the test doesn't modify global state. Another, maybe better way would be to include actionpack in Gemfile with a `require: false` and load that. This way the test wouldn't rely on an implementation detail.