How can you universally override the get and post methods in RSpec? <p>I'd like to override the <code>get</code> and <code>post</code> methods in RSpec. </p> <p>I want to do this in order to deal with subdomains in my tests. As far as I can tell, the only way to deal with subdomains is to alter the <code>@request</code> object before each call. I could do this before each and every test but that's going to lead to some really messy code.</p> <p>In an effort to keep things DRY I've tried using a <code>config.before(:each)</code> method in <code>spec_helper.rb</code> however this doesn't seem to be run in the same scope as the test and doesn't have access to <code>@request</code>.</p> <p>My next bsest approach is therefore to overrride <code>get</code> and <code>post</code> which are in the correct scope.</p> <pre><code>def get *args @request.host = @required_domain if @required_domain super *args end </code></pre> <p>I can include this code in the top of each spec file but I'd rather set it universally. If I set it in <code>spec_helper.rb</code> though it does not get called. </p> <p>Where can I set this to override the default <code>get</code> method?</p>