Vita Rara: A Life Uncommon

Testing

Shoulda: should_validate_uniqueness_of


Categories: | | |

When testing an ActiveRecord model that validates_uniqueness_of using Shoulda's should_validate_uniqueness_of macro it needs to be wrapped in a context where an instance of the model is created in the database. If there is no record in the database to validate against you'll get an error.

For more information see: Lighthouse Ticket.

Testing Non-Ruby Applications with Cucumber


Categories: | | | | |

Yesterday we got Cucumber working to test an older J2EE application that uses EJB 2.1 for its persistence layer. This application because of the J2EE EJB 2.1 beans has been very hard to near impossible to test in the past. I've been hearing about Cucumber for a while and we decided it was time to take a deeper look.

We plan on adding new features to this application using Rails, and over time porting the existing functionality to Rails. So, having a test suite written in Ruby that can test the application regardless of the underlying implementation was necessary. Cucumber with Webrat to the rescue. The general outline below will work with web applications written in any language. All of the interaction with the application happens at the HTTP protocol level.

Syndicate content