apneadiving / Google-Maps-for-Rails

Enables easy Google map + overlays creation in Ruby apps
https://apneadiving.github.io/
MIT License
2.26k stars 382 forks source link

The capability to disable geocoding during tests #164

Closed tcannonfodder closed 12 years ago

tcannonfodder commented 12 years ago

I think it'd be extremely useful to allow geocoding to be disabled for a model within a test suite. That way, developers don't accidentally reach the allowance provided by geocoding servers (such as how Google Maps only allows 2,500 requests per day) while their test suite is running. I'd be willing to attempt to implement this (I've never worked on a gem before), or provide documentation for the feature if it has already been completed.

apneadiving commented 12 years ago

I should document this but I usually proceed with one of the following:

With user an instance_variable:

user.instance_eval do 
    def process_geocoding; end
end
apneadiving commented 12 years ago

Rethinking the design, I guess I'd better use a before_filter instead of a validator.

tcannonfodder commented 12 years ago

Would you overwrite the existing method in the spec_helper?

tcannonfodder commented 12 years ago

Would you have to rewrite something in the gem, or is that something that the test suite would have to implement?

On Mar 17, 2012, at 3:55 PM, Benjamin Roth wrote:

Rethinking the design, I guess I'd better use a before_filter instead of a validator.


Reply to this email directly or view it on GitHub: https://github.com/apneadiving/Google-Maps-for-Rails/issues/164#issuecomment-4556602

apneadiving commented 12 years ago

Just realized what you need is only a factory where you set the geocoding checker to true (gmaps is the default name).

apneadiving commented 12 years ago

Please close the Issue if it answers :)