I have two blocks of tests: one for testing positive outcomes and one for testing negative. After poking around, I've concluded that the underlying :verify_credentials method is getting called, despite the stub:
describe 'electricity credentials' do before(:each) do @wizard.electricity_service = MeteredService::Base.create!() end it 'with valid credentials should spawn external loader' do @wizard.electricity_service.stub(:verify_credentials).and_return(true) @wizard.electricity_loader.stub(:start) @wizard.electricity_loader.should_receive(:start) @wizard.validate_setting_electricity_credentials end it 'with invalid credentials should not spawn external loader' do @wizard.electricity_service.stub(:verify_credentials).and_raise('no can do') @wizard.electricity_loader.stub(:start) @wizard.electricity_loader.should_not_receive(:start) @wizard.validate_setting_electricity_credentials end end Am I missing something fundamental about .stub()? - ff -- Posted via http://www.ruby-forum.com/. _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users