How do I test the rescue block of a method with rspec mocks 3.3
问题 Help me make this test pass: Here is an example of some rspec code, class User attr_accessor :count def initialize @count = 0 end # sometimes raises def danger puts "IO can be dangerous..." rescue IOError => e @count += 1 end #always raises def danger! raise IOError.new rescue IOError => e @count += 1 end end describe User do describe "#danger!" do it "its rescue block always increases the counter by one" do allow(subject).to receive(:'danger!') expect { subject.danger! }.to change(subject,