Rspec: expect vs expect with block – what’s the difference?

As has been mentioned: expect(4).to eq(4) This is specifically testing the value that you’ve sent in as the parameter to the method. When you’re trying to test for raised errors when you do the same thing: expect(raise “fail!”).to raise_error Your argument is evaluated immediately and that exception will be thrown and your test will blow … Read more