RubyFlow The Ruby and Rails community linklog

Hash#fetch default value gotcha

I wrote a tiny blog post about Hash#fetch default value gotcha.

Comments

Right now proudly owning a completely new and trendy wanting replica rolex are certainly not only designed for the rich persons.They’re now created luxurious and very affordable swiss replica watches to reach out to each spending plan and variety.You are able to just appreciate them by ordering replica watches on-line in which you have the total pleasure and real top quality at best possible rates.You are able to choose from the big variety of fake watches by comparing plenty of fantastic and gorgeous items.The end, top quality and models you receive from rolex replica watches are actually astonishing and also you will like them all.These rolex replica 2836 are outstanding and demonstrate to get amazing to suit your needs whilst it makes you jump out on the crowd.Distinctive variations and layouts of replica watch are actually out there to make your wrist stunning.These rolex replica 41mm could be great investments for yourself in extensive expression.

Excellent article! There’s a related issue that can come up in Rspec tests: if you say expect(some_method_call).to eq('hi'), that works fine. But if you say expect(some_method_call).to raise_error(SomeError), and it does raise that error, your test will fail! That’s because the error is raised when the method is called, right there inside your expect() parentheses, before Ruby ever looks at the .to raise_error part.

Instead, you have to give it a block: expect {some_method_call}.to raise_error. That way it can hang onto that block, see that it’s supposed to expect an error, then call it when it’s ready and see what happens.

Post a comment

You can use basic HTML markup (e.g. <a>) or Markdown.

As you are not logged in, you will be
directed via GitHub to signup or sign in