Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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)?

like image 987
Hakan Ensari Avatar asked Apr 30 '10 13:04

Hakan Ensari


1 Answers

Figured out meself:

view.should_receive(:current_user).and_return(mock("user"))
like image 178
Hakan Ensari Avatar answered Sep 28 '22 06:09

Hakan Ensari