Added ActiveResource.format= which defaults to :xml but can also be set to :json [DHH]. Added one-off declarations of mock behavior [DHH]

Nice work. I actually did similar work recently, but hadn't had the cycles to contribute it back. I'll be sure to provide some feed back though.

Cheers, Rus

Thanks. It could be great if people could put this stuff through the ringer. I haven't had a chance to do a real thorough testing of it yet in the wild.

I see that deserialization of error response bodies in validation.rb hasn't been refactored yet to use the new format serialization abstraction, ie. (below). Should I add something to Trac about this?

# Grabs errors from the XML response.     def from_xml(xml)       clear       humanized_attributes = @base.attributes.keys.inject({}) { |h, attr_name| h.update(attr_name.humanize => attr_name) }       messages = Hash.from_xml(xml)['errors']['error'] rescue       messages.each do |message|         attr_message = humanized_attributes.keys.detect do |attr_name|           if message[0, attr_name.size + 1] == "#{attr_name} "             add humanized_attributes[attr_name], message[(attr_name.size + 1)..-1]           end         end

        add_to_base message if attr_message.nil?       end     end

I added a couple of issues to Trac (9681, 9683, 9684). 83 and 84 are relevant to your format work.