Cucumber/Webrat 用户会话 flash[:notice] 问题在 Rails 3 中仍然存在
嗨,我不久前遇到过这个问题...
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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好的,找到解决方案了。
我用 capybara 替换了 webrat,一切都很好。
Ok, found a solution.
I replaced webrat with capybara and everything is good.