Cucumber/Webrat 用户会话 flash[:notice] 问题在 Rails 3 中仍然存在

发布于 2024-10-03 19:45:25 字数 961 浏览 0 评论 0原文

嗨,我不久前遇到过这个问题...

authlogic flash[:notice] 没有出现在 cucumber webrat 步骤中

而且看起来它仍然存在于 Rails 3 中,这是建议的修复。

    class RackRailsCookieHeaderHack
  def initialize(app)
    @app = app
  end

  def call(env)
    status, headers, body = @app.call(env)
    if headers['Set-Cookie'] && headers['Set-Cookie'].respond_to?(:collect!)
      headers['Set-Cookie'].collect! { |h| h.strip }
    end
    [status, headers, body]
  end
end

config.after_initialize do
  ActionController::Dispatcher.middleware.insert_before(ActionController::Base.session_store, RackRailsCookieHeaderHack)
end

这解决了 2.3.8 的问题...我必须将其放在 config/environment/cucumber.rb 中,

但在 Rails 3 中该文件不再可用,并且在 config/environment/test.rb 中我无法在中间件

根据 lighthouse bugtracker 这应该被修复...有人可以确认这个问题在 Rails 3 中仍然存在吗?任何帮助都会很棒吗?

Hi I ran in this issue a while ago...

authlogic flash[:notice] does not show up in cucumber webrat step

And it looks like it still exisits in rails 3 this was a suggested fix.

    class RackRailsCookieHeaderHack
  def initialize(app)
    @app = app
  end

  def call(env)
    status, headers, body = @app.call(env)
    if headers['Set-Cookie'] && headers['Set-Cookie'].respond_to?(:collect!)
      headers['Set-Cookie'].collect! { |h| h.strip }
    end
    [status, headers, body]
  end
end

config.after_initialize do
  ActionController::Dispatcher.middleware.insert_before(ActionController::Base.session_store, RackRailsCookieHeaderHack)
end

this fixed the issue with 2.3.8... I had to place it in the config/environment/cucumber.rb

but in Rails 3 this file is not available anymore and in config/environment/test.rb I cannot inject something in the middleware

according the lighthouse bugtracker this should be fixed... can someone confirm that this problem still exists with Rails 3? Any help would be great?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

绾颜 2024-10-10 19:45:25

好的,找到解决方案了。

我用 capybara 替换了 webrat,一切都很好。

Ok, found a solution.

I replaced webrat with capybara and everything is good.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文