Archive

Posts Tagged ‘shoulda’

Webrat for integration testing

August 17th, 2009 mindtonic No comments

should_eventually write this test

August 17th, 2009 mindtonic No comments

One thing I liked about rspec was the ability to define tests that you had not yet written. That way you could remind yourself when running the test suite that there are things still to do. Previously in Shoulda, I have been writing these kinds of tests in all caps and using “assert false” to trigger failure and remind me of future work. Turns out there is a nifty way to do it with Shoulda. (I should have guessed there would be!)

should_eventually "do something"

#or just leave off the block
should "do something"

Thanks to BlenderBox for bringing this to my attention while researching Shoulda integration testing.

Categories: Uncategorized Tags: ,

Factory Girl stringify_keys error in Create Test

July 21st, 2009 mindtonic No comments

I was getting the following error while trying to test the create method of a controller using factory_girl and shoulda:

NoMethodError: undefined method `stringify_keys!`

The error was that I am sending an object to the create method, which actually requires a hash of attributes… the solution is to use factory_girl’s attributes_for method.

Hope this helps!

Categories: Development Tags: ,

Shoulda Testing With Ultrasphinx

June 24th, 2009 mindtonic 2 comments

I use the Shoulda testing framework for my Rails applications. After installing and beginning to use the Ultrasphinx plugin, I needed to figure out how to configure and run in a testing environment. This blog entry held the answer: Stephen Celis: Testing with Ultrasphinx