Sha256: 9a205fc0855f5b1fc5fd1bd0a49b1f5cbfb8445ae3e3d80e7fc92b862a053bf9
Contents?: true
Size: 1.14 KB
Versions: 1
Compression:
Stored size: 1.14 KB
Contents
require 'sinatra' module VCR class SinatraApp < ::Sinatra::Base get '/' do "GET to root" end get '/search' do "query: #{params[:q]}" end get '/localhost_test' do "Localhost response" end get '/foo' do "FOO!" end post '/foo' do "FOO!" end get '/set-cookie-headers/1' do headers 'Set-Cookie' => 'foo' 'header set' end get '/set-cookie-headers/2' do headers 'Set-Cookie' => %w[ foo bar ] 'header set' end # we use a global counter so that every response is different; # this ensures that the test demonstrates that the response # is being played back (and not running a 2nd real request) $record_and_playback_response_count ||= 0 get '/record-and-playback' do "Response #{$record_and_playback_response_count += 1}" end def self.port server.port end @_boot_failed = false def self.server raise "Sinatra app failed to boot." if @_boot_failed @server ||= begin VCR::LocalhostServer.new(new) rescue @_boot_failed = true raise end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
vcr-2.0.0.beta2 | spec/support/sinatra_app.rb |