Save 36% for Black Friday! Learn more

All threads / Accounts middleware and integration tests?

Ask A Question

Notifications

You’re not receiving notifications from this thread.

Accounts middleware and integration tests?

Dan Charlesworth asked in Testing

Hi folks —

I'm a big fan of the Accounts Middleware pattern introduced about a year ago in this tutorial:
https://gorails.com/episodes/rails-active-support-current-attributes

Super powerful. Applicable to just about any B2B app. I'm keen to use it in something customer-facing.

I'm currently hung up on the fact that integration tests all break with the accounts middleware in place. To quote a commenter on the episode thread:

All controllers actions fail because env["REQUEST_PATH"] is nil

I watched the follow-up about testing the middleware with system tests, but I'm not quite sophisticated enough to figure how to apply the lessons there to integration tests.

Does anyone have any ideas?

Join the discussion

Want to stay up-to-date with Ruby on Rails?

Join 39,609+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.

    logo Created with Sketch.

    Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

    © 2020 GoRails, LLC. All rights reserved.