Hi all
In my app I'd like to send a request to google sitemaps indexer after
a new post is created.
This would take place in the post_observer and would look something
like this:
require 'net/http'
require 'uri'
class PostObserver < ActiveRecord::Observer
include ActionController::UrlWriter
default_url_options[:host] = "mydomain.com"
def after_create(post)
Net::HTTP.get('www.google.com', '/ping?sitemap=' + URI.escape
(sitemap_url))
end
end
How could I write a test for this?
Also - how could I disable the actual request while running in test
mode?
Thanks
Gavin
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---