Displaying 1 result from an estimated 1 matches for "find_all_activated".
2007 Jul 16
4
RSpec - concerns about mocking
...in your
controller specs you mock it up like so:
@user = mock_model(User)
User.stub!(:find_activiated).and_return(@user)
Everything works great, and specs execute fast due to limited DB access.
What if I then refactor, and decide to rename the find_activated method
to a more descriptive User.find_all_activated ? So I change the model
spec to reflect the new name, then change the method name in the model,
and all specs pass. Awesome.
So I hit my app and it crashes. I get "no method find_activated for
User". My controller specs are mocking a method that no longer exists
in the real app. As...