Tag Archives: rspec

Testing that a block is called

CapnKernul asks: Hey Avdi. How would you test that a method’s provided block is called in RSpec? Would you stub #to_proc (for &block) and mock #call? Typically the way I test that a block is called goes something like this: … Continue reading

Posted in Ruby | Tagged , , | 4 Comments

Linkdump #7

Hacker Chat: Pinboard Creator Maciej Ceglowski Talks About Why Boring Architecture is Good, and More Wise words. tags: development I think many developers (myself included) are easily seduced by new technology and are willing to burn a lot of time … Continue reading

Posted in Links | Tagged , , , , , , , , , , , | Leave a comment

RSpec is for the literate

A couple years ago I wrote a library called AlterEgo. It’s an implementation of the State Pattern for Ruby. I consider the library to be retired at this point—other libraries, such as State Machine and ActiveModel, have since incorporated all … Continue reading

Posted in Rants | Tagged , , , , , , | 22 Comments

The happy developer

The programmer has a fixed amount of time and concentration that he can give every day. HeĀ mustĀ give a bigger piece of the pie to the bad technologies, simply because they require more. In other words, he ends up spending most … Continue reading

Posted in Rants | Tagged , , , , , , | 3 Comments

Complex Hash Expectations in RSpec

When spec-ing something that calls method which takes a set of nested hashes (as many Rails methods do), it may be tempting to use #hash_including: to test for only the values you care about. However #hash_including won’t work the way … Continue reading

Posted in Ruby, Uncategorized | Tagged , , , | 3 Comments