Displaying 2 results from an estimated 2 matches for "things_controller_spec".
2007 Jun 09
11
authentication, controller specs. I think I''m missing something simple ....
...e a use-case that crops
up in my application.
The basic issue I''m struggling with is how does define mocks/stubs for a
controller method that does something of the form:
method_a.method_b.find
Pasted code/spec/errors here
* things_controller http://pastie.caboo.se/69136
* things_controller_spec http://pastie.caboo.se/69137
* Errors w/ find(:all) http://pastie.caboo.se/69138
--
Rick
rick.tessner at gmail.com
2007 Oct 25
1
Mocking/Stubbing help with subdomain as account key
...with RSpec''s mocking and
stubbing? Basically, I need to test that @current_person.things is
getting the find message and returning @thing. I''ve tried stubbing
and mocking @current_person.things a number of different ways with no
luck. Here''s my latest attempt:
# things_controller_spec.rb
before do
@request.host = "subdomain.test.host"
@thing = mock_model(Thing)
@current_person = mock("person") # <= THE MOCKS IN QUESTION
@current_person.stub!(:things).and_return(Thing)
@current_person.things.stub!(:find).and_return(@thing)
end
def do_ge...