最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Rails 5 Upgrade- request.fullpath not returning the same value as Rails 4 for Controller Tests - Stack Overflow

programmeradmin1浏览0评论

I've recently upgraded my app to Rails 5.2 from Rails 4.2 and I'm seeing some fallout in my in my contrioller tests.

In the Rails 4 engine, the value of the request.fullpath in my test case returns as:

'/myapp/foo/new'

But the same controller tests fail in the Rails 5 engine, whereby request.fullpath is now:

'/foo/new'

I don't know if I'm missing some configuration after the upgrade. I can see that when setting this let variable, its getting the correct path:

let(:return_to) { MyApp::Engine.routes.url_helpers.new_foo_path }

So far, my only workaround in the tests is to do add the following to teh request before the tests run.

 request.env["SCRIPT_NAME"] = "/myapp"

what am i missing?

发布评论

评论列表(0)

  1. 暂无评论