The last few days I wrote some unit tests for a project I’m currently working on (and which, by the way, should be released to public in a few weeks time). To easily be able to change attributes of my models and not rely on fixtures, I’m using the fixture_replacement plugin and actsasgeocodable to easily deal with address translations and that stuff (it introduces various attributes, like street, country, postal code,…). The last one comes with a nice option, normalized_address, which will update the information in your model with the information it got from the geocoding service (and thus will correct invalid postal codes, etc.).
Well, again, this feature is really handy but can lead to problems if you forgot that you activated it and just want to change the postal code of one of your models. Because the geocoder will still find the right address (mainly because the street name is the same) and actsasgeocodable will correct the invalid postal code for you. And you gonna have no clue why it won’t take the postal code you’ve used in fixture_replacement’s helper methods.
A simple fix for that is to add the following setup method into your unit tests:
def setup # This ensures that we can set individual attributes of our model # without being overridden by acts_as_geocodable. Property.acts_as_geocodable_options[:normalize_address] = false end

