Skip to content

Instantly share code, notes, and snippets.

@bkempner
Created July 19, 2011 19:53
Show Gist options
  • Save bkempner/1093545 to your computer and use it in GitHub Desktop.
Save bkempner/1093545 to your computer and use it in GitHub Desktop.
Rspec wtf?
## Controller
class FooController < ActionController::Base
def wtf
SomeObject.foo
end
end
## Spec File
describe FooController do
it 'responds to wtf' do
has_actions :get, :wtf
end
it '#wtf' do
mock.proxy(SomeObject).foo.with_any_args
get :wtf
end
end
## Spec Results
.F
Failures:
1) FooController#wtf
Failure/Error: mock.proxy(SomeObject).foo.with_any_args
RR::Errors::TimesCalledError:
find()
Called 0 times.
Expected 1 times.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment