test/integration/server.rb in roar-0.12.9 vs test/integration/server.rb in roar-1.0.0.beta1

- old
+ new

@@ -1,9 +1,9 @@ require "bundler/setup" require "sinatra" require "ostruct" -require "roar/representer/json" +require "roar/json" require "sinatra/multi_route" require File.expand_path("../band_representer.rb", __FILE__) class Band @@ -75,11 +75,22 @@ delete '/bands/metallica' do status 204 end +route :get, :delete, :patch, :post, :put, %r{/bands/nirvana/status([\d]*)_and_data} do + status params[:captures] + OpenStruct.new(:name => "Nirvana", :label => "Sub Pop"). + extend(Integration::BandRepresenter). + to_json +end +route :get, :delete, :patch, :post, :put, %r{/bands/nirvana/status([\d]*)_no_data} do + status params[:captures] +end + + helpers do def protected! return if authorized? headers['WWW-Authenticate'] = 'Basic realm="Restricted Area"' halt 401, "Not authorized\n" @@ -104,6 +115,6 @@ %{{"name": "Bodyjar"}} end get "/ping" do "1" -end \ No newline at end of file +end