Internal refactoring to enable opt-out of infer filetype behaviour

Re-issue of https://github.com/rspec/rspec-rails/pull/968 against master.

@alindeman @myronmarston