Hoist inner `shared_context` definition to top level.

This will hopefully fix double definition warning in rspec.