test/fake_server.rb in roar-0.8.2 vs test/fake_server.rb in roar-0.8.3
- old
+ new
@@ -1,10 +1,31 @@
require "bundler/setup"
require 'sinatra/base'
require 'sinatra/reloader'
+require 'roar/representer/xml'
+# Usually shared in a gem between service and clients.
+module BandRepresenter
+ include Roar::Representer::XML
+ property :name
+ property :label
+end
+
+Band = Struct.new(:name, :label)
+Band.class_eval do
+ include Roar::Representer::XML
+ include BandRepresenter
+end
+
-class FakeServer < Sinatra::Base
+class FakeServer < Sinatra::Base
+ BANDS = {"belvedere" => Band.new("Belvedere", "canadian maple")}
+
+ get "/bands/:id" do
+ BANDS[params[:id]].to_xml
+ end
+
+
get "/method" do
"<method>get</method>"
end
post "/method" do