Skip to content

Instantly share code, notes, and snippets.

@pol
Created December 3, 2008 18:10
Show Gist options
  • Select an option

  • Save pol/31632 to your computer and use it in GitHub Desktop.

Select an option

Save pol/31632 to your computer and use it in GitHub Desktop.
def test_formats_on_nested_element
@nested = { :id => 2, :name => 'Nested', :data => {:foo => ''}}
for format in [ :json, :xml ]
using_format(Person, format) do
ActiveResource::HttpMock.respond_to.get "/people/1.#{format}", {'Accept' => ActiveResource::Formats[format].mime_type}, ActiveResource::Formats[format].encode(@nested)
assert_equal @nested[:name], Person.find(1).name
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment