How to use request helpers outside of controller specs?

I asked this questions on some other places before, but have found no
solution yet. I’d like to include the request helper (from
ActionDispatch::Integration::RequestHelpers, like post and xhr
methods) also in some specs outside of my controller specs. The
problem is that these request helpers are only included in spec/
controller and when a controller is described.
What do I have to include/require in those specs?

Best regards,

I just solved the problem by including the below code in my acceptance
helper. If you are not Steak then just simply put it in spec helper or
require it from somewhere else. post and xhr methods are now available
in that spec regardless in what spec it is or in what directory you

The code is derived from RSpec::Rails::RequestExampleGroup

RSpec::Core::ExampleGroup.class_eval do
  include ActiveSupport::Concern
  include ActionDispatch::Integration::Runner
  include RSpec::Rails::BrowserSimulators

  def app

  def last_response

On Nov 17, 2010, at 3:06 AM, medihack wrote:

include ActiveSupport::Concern

Can I ask why you want this outside controller and/or request specs?

Can I ask why you want this outside controller and/or request specs?

Of course. I’d like to test some web services and XMLHttpRequests with
Steak. For that I need the post and xhr methods of the request
helpers. Steak uses an acceptance folder where the request helpers are
not available. I wonder a bit as a Steak spec itself tries to use the
get method in one example, but also fails (was there a change in RSpec
lately and Steak is not up-to-date?).