开发者

Mocking view helpers with rspec-rails 2.0.0.beta.8

开发者 https://www.devze.com 2022-12-28 13:27 出处:网络
I am trying to mock a view helper with rspec2. The old way of doing this throws an error, complaining the template object is not defined:

I am trying to mock a view helper with rspec2. The old way of doing this throws an error, complaining the template object is not defined:

开发者_运维百科template.should_receive(:current_user).and_return(mock("user"))

Am I missing something here, or is this not implemented in rspec2 (yet)?


Figured out meself:

view.should_receive(:current_user).and_return(mock("user"))
0

精彩评论

暂无评论...
验证码 换一张
取 消