I have upgraded my project to rails 4 but now I am getting some deprecation warnings and one of them is DEPRECATION: any_number_of_times is deprecated.. Code for which I am gettings this warning is
sponsorship = RSpec::Mocks::Mock.new(:sponsorship)
SPONSORSHIP.should_receive(:[]).with('sponsorship').any_number_of_times.and_return(sponsorship)
and another scenario is
sponsorship.should_receive(:[]).with(key).any_number_of_times.and_return(value)
I have used stub for above code but it is not stubbing correctly. Can you find where I am doing it wrong. For stubbing I have used
SPONSORSHIP.stub(:[]).with('sponsorship').and_return(sponsorship)
any_number_of_times
it makes sense that the should_receive would default to at least once. – Selfreliant