Musician, Ruby on Rails Entusiast, Composer, Programmer and Lover of Hot Sauce

Webrat for integration testing

Posted: August 17th, 2009 | Author: mindtonic | Filed under: Uncategorized | Tags: , , , | No Comments »

Webrat:

Integration Testing:


should_eventually write this test

Posted: August 17th, 2009 | Author: mindtonic | Filed under: Uncategorized | Tags: , | 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.


Factory Girl stringify_keys error in Create Test

Posted: July 21st, 2009 | Author: mindtonic | Filed under: Development | Tags: , | 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!


Shoulda Testing With Ultrasphinx

Posted: June 24th, 2009 | Author: mindtonic | Filed under: Rails Plugins | Tags: , , , , | 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