Converting testcase to rspec

I should really switch from test-unit to rspec when I wrote my first ruby test. It’s so clean, so readable, and so powerful.

I have been fighting for a long time to install mocha to enable mock to test-unt, but rspec has the built-in mock/stub functions, and it’s very easy to use.

Install icov, ruby code coverage is a little bit challenge, while the built-in JRuby in Netbeans has everything pre-setup. I still wanna to setup those ruby magic by my own, rubygem made everything so much easier, just run gem install whatever_you_name_it, it not, download gem, gem install my_download_gem.

The funny part is, the default MacOS seems missing some header files, which stopped me from using gem smoothly on Mac. The solution is, install XCode with unix developer tool, it fixed this issue.

Write spec first, watch out the coverage percentage, right now coding ruby is so much fun.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s