Category Archives: Testing
TDD Makes Software Go Faster
One of the gripes I hear about TDD is that it takes too much time. People look at the idea of it and think, “So I have to write code and tests and update the tests when the code changes? … Continue reading
Quick Hits: Unit Testing iPhone Apps
I have a few things to add to the woefully incomplete official documentation on setting up automated tests in your iPhone apps: You need to add your main application executable target as a direct dependency of the test target, so … Continue reading
Quick Hits: Setting the User Agent Header in Webrat
If you’ve read the new PragProg beta e-book on RSpec, you may have read that you can set HTTP headers for your Webrat request like so: Given /^I am browsing the site using Safari$/ do header "User-Agent" , "Mozilla/5.0 (Macintosh; … Continue reading
Using assert_select to find an attribute that has square brackets in the value
Problem: assert_select ‘input[name=model_name[field_name]]’ gives ArgumentError: Invalid selector: ] Solution: assert_select ‘input[name=?]‘, ‘model_name[field_name]‘ Thanks to the Boston Ruby Group thread for the answer. Bonus: Here’s a helpful assert_select cheat sheet.