[LRUG] Ruby on Rail 4.2 networking breakfast (Graeme McCubbin)

Andrew White andrew.white at unboxedconsulting.com
Sun Jul 6 15:00:45 PDT 2014


On 6 Jul 2014, at 22:26, James Ladd <ladd.james at gmail.com> wrote:

> Simply we want to test our app which receives a http request through rails and in response to that request it can fire off background events also via http to the same application.

Why are you trying to make things complicated by calling back via HTTP into your app? Even if for some strange reason a background processing library like Sidekiq or Resque doesn't do what you need there's no need to go back over the wire - just call the Rack endpoint directly. For example you can call a controller action like this:

  env = Rack::MockRequest.env_for('/')
  status, headers, body = PagesController.action(:index).call(env)

Though I wouldn't recommend this as a real solution - you should refactoring your code so you can call it directly without the request overhead.

> and even a nil doesn't understand reverse in the SQL layer.

I'm not sure exactly what you're saying here - please expand on what you mean.


Andrew White
Rails Core Team Member




More information about the Chat mailing list