Skip to main content

Accounts middleware and integration tests?

Testing • Asked by Dan Charlesworth

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?


Login or Create An Account to join the conversation.

Subscribe to the newsletter

Join 24,647+ developers who get early access to new screencasts, articles, guides, updates, and more.

    By clicking this button, you agree to the GoRails Terms of Service and Privacy Policy.

    More of a social being? We're also on Twitter and YouTube.