RSpec: Stub private method
rspec, rspec2, ruby, ruby-on-rails, ruby-on-rails-3
Solution
`should_receive(:method)` works whether the visibility of `:method` is public or private.
Problem
I try to test a class with RSpec2, that has some private methods, which are called from some public methods. I test the public methods with ``` @foo.should_receive(:start_training).exactly(2).times ``` if they are called and how often. My problem is, that this approach doesn't work with private methods. So, is there any way to use sth like `@foo.send(:private_method)` in combination with `should_receive`? Or any other syntax?