2010-04-23 4 views
0

어떻게하면 rspec 및 remarkable으로 before_filter를 테스트 할 수 있습니까? rspec + 주목할만한 + before_filter

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

그러나이 결과 놀라운와

:

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

답변

0
expects :logged_in?, :on => proc { @controller }, :returns => true 

(솔루션 here을 발견)만을 RSpec에와 내가 좋아하는 뭔가를 할 것입니다