I’d like to use the request helpers
(ActionDispatch::Integration::RequestHelpers
) outside of my RSpec controller tests (in other RSpec tests), but I
don’t know how to include and use them there.
Best regards,
Kai
I’d like to use the request helpers
(ActionDispatch::Integration::RequestHelpers
) outside of my RSpec controller tests (in other RSpec tests), but I
don’t know how to include and use them there.
Best regards,
Kai
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
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
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs