aboutsummaryrefslogtreecommitdiffstats
path: root/activeresource
diff options
context:
space:
mode:
Diffstat (limited to 'activeresource')
-rw-r--r--activeresource/examples/simple.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/activeresource/examples/simple.rb b/activeresource/examples/simple.rb
new file mode 100644
index 0000000000..b20ef61670
--- /dev/null
+++ b/activeresource/examples/simple.rb
@@ -0,0 +1,16 @@
+$LOAD_PATH.unshift "#{File.dirname(__FILE__)}/../lib"
+require 'active_resource'
+require 'active_resource/http_mock'
+require 'active_support/core_ext/hash/conversions'
+
+ActiveSupport::XmlMini.backend = ENV['XMLMINI'] || 'REXML'
+ActiveResource::HttpMock.respond_to do |mock|
+ mock.get '/people/1.xml', {}, { :id => 1, :name => 'bob' }.to_xml(:root => 'person')
+end
+
+class Person < ActiveResource::Base
+ self.site = 'http://localhost/'
+end
+
+bob = Person.find(1)
+puts bob.inspect