【问题标题】:rspec + remarkable + before_filterrspec +显着+ before_filter
【发布时间】:2010-04-23 14:04:06
【问题描述】:

如何使用 rspec 和 remarkable 测试 before_filter。只有 rspec 我会做类似的事情:

 controller.stub(:logged_in?).and_return(true)

但结果显着:

undefined local variable or method `controller' for #<Class:0x7f8f056ef3c0> (NameError)

【问题讨论】:

    标签: ruby-on-rails rspec before-filter


    【解决方案1】:
    expects :logged_in?, :on => proc { @controller }, :returns => true 
    

    (找到解决方案here

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-01-23
      • 2018-11-02
      • 1970-01-01
      • 2011-08-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多