代码之家  ›  专栏  ›  技术社区  ›  server info

Cuth/WebRAT用户会话Flash [通知]在Rails 3中仍然存在

  •  0
  • server info  · 技术社区  · 14 年前

    嗨,我刚才在这期杂志上发表过。。。

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

    看起来它仍然存在于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中,我不能在中间件中注入一些东西

    根据灯塔追踪器,这应该被修复。。。有人能确认这个问题仍然存在于轨道3吗?有什么帮助吗?

    1 回复  |  直到 8 年前
        1
  •  0
  •   server info    14 年前

    好吧,找到解决办法。

    我用水豚代替了韦伯拉,一切都很好。