Tag Archives: rspec

awesome rspec hints and tips

Read “Pure Rspec”, a great slideshow by Jon “Lark” Larkowski.
It contains some really cool rspec tips and hints, how to write your tests more readable and compact.

rails3 and rspec2 view testing

Testing the view in Rspec is just great. It allows you to test the view in total isolation. It just does the render. Make sure you set up some data that is needed, and then check if all areas are available for instance.
Now for Rspec2 a lot of things have changed:

have_tag is no longer supported: [...]

rspec testing using macros

STATUS_EXPECTED_TRANSLATIONS = [ [inp1, outp1], … ]

it "should translate received statuses" do
STATUS_EXPECTED_TRANSLATIONS.each do |tr|
controller.send(’translate_status_to_envelope_status’, tr[0]).should == tr[1]
[...]

skipping slow tests in rspec2

For Test::Unit there is a module called skippy, that allows you to skip for instance slow tests.
I was looking for a way to achieve the same in Rspec. I am currently developing against Rails 3.0.0.rc, and using rspec 2.0.0.beta.19 and could not find anything. So i asked on the rspec mailing list and got a [...]

missing ‘a’ with rspec and cucumber

I am developing Ruby on Rails on Windows platforms mostly. But using Rspec and cucumber on windows has a very strange side-effect: all a’s are missing as can be seen from the following screenshot:

Luckily, after some very extensive googling, i found a single blogpost with a fix!
Apparently it has something to do with UTF-8 [...]