mocking - Alternate of any_number_of_times method in stubs -
i have upgraded project rails 4 getting deprecation warnings , 1 of them deprecation: any_number_of_times deprecated.. code gettings warning is
sponsorship = rspec::mocks::mock.new(:sponsorship) sponsorship.should_receive(:[]).with('sponsorship').any_number_of_times.and_return(sponsorship) and scenario
sponsorship.should_receive(:[]).with(key).any_number_of_times.and_return(value) i have used stub above code not stubbing correctly. can find doing wrong. stubbing have used
sponsorship.stub(:[]).with('sponsorship').and_return(sponsorship)
the method any_number_of_times deprecated (and going away in rspec 3) because it's not testing anything. never fail, since can called 0 times well. see extended argument in https://trello.com/c/p2osobva/78-update-website-menu-architecture-to-accommodate-pledging-as-well-as-weddings-memorials-etc.
if expect called @ least once, can use at_least(1).times.
Comments
Post a Comment