[rspec-users] How to use request helpers outside of controller specs?

David Chelimsky dchelimsky at gmail.com
Wed Nov 17 05:35:52 EST 2010

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

> 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
> are.
> The code is derived from RSpec::Rails::RequestExampleGroup
> <pre>
> RSpec::Core::ExampleGroup.class_eval do
>  include ActiveSupport::Concern
>  include ActionDispatch::Integration::Runner
>  include RSpec::Rails::BrowserSimulators
>  def app
>    ::Rails.application
>  end
>  def last_response
>    response
>  end
> end
> </pre>

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

More information about the rspec-users mailing list