Tag Archives: testing

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

Making a Mockery of TDD

I made this gnomic remark on Twitter the other day: To be a successful mockist, you must dislike mocks. A lot of people re-tweeted it, so I guess I’m not completely alone in thinking this way. I should back up … Continue reading

Posted in Uncategorized | Tagged , , , , , , , , , , | 10 Comments

Software Superstitions

If we are not honest about the causes of a bad situation, we pose a significant danger to those who are either less-experienced or uncertain about their own situation. Take a slow test suite, for example. Having a test suite … Continue reading

Posted in Rants | Tagged , , | Leave a comment

Demeter: It’s not just a good idea. It’s the law.

Is #try really so bad? In response to my recent post about #try being a code smell, a lot of people made the reasonable objection that the example I used—of using #try on a a Hash—was a pathological case. A … Continue reading

Posted in Ruby | Tagged , , , , , , , , , , , , | 67 Comments

Linkdump #8

Scriptensity: Emscripten 1.0! This is the first I’ve heard of this project: it’s an LLVM-to-Javascript compiler. Which means you can (for instance) compile C++ to Javascript. I can’t decide if this is amazing or just batshit insane. Probably both. tags: … Continue reading

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

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

Roy Osherove on Test Construction

It’s quite easy to get caught up in the technique of TDD and not pay attention to the way unit tests are written: their naming, how maintainable or readable they are, and whether they test the right things or might … Continue reading

Posted in Quotes | Tagged , , | Leave a comment

Rack-Test and Capybara are uneasy bedfellows

I’m using Capybara on a new project because apparently it’s the new hotness. Today I found out that all is not peaceful in the Cucumber/Capybara/Rack-Test stack. There is a cold war going on, and both Capy and Rack-test are jealously … Continue reading

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

Looking for a new NullDB maintainer

I love Open Source. NullDB, a weekend hack that I barely touched after its first version, continues to attract periodic forks and patches. For a long time I’ve been meaning to sit down and roll in all the contributions that … Continue reading

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