标签: ruby-on-rails rspec before-filter
如何使用rspec和remarkable测试before_filter。只有rspec我会做类似的事情:
controller.stub(:logged_in?).and_return(true)
但结果非常明显:
undefined local variable or method `controller' for #<Class:0x7f8f056ef3c0> (NameError)
答案 0 :(得分:0)
expects :logged_in?, :on => proc { @controller }, :returns => true
(找到解决方案here)