From b7672753259038181343216e47523846e427a410 Mon Sep 17 00:00:00 2001 From: Blake Mizerany Date: Thu, 4 Oct 2007 11:40:32 -0700 Subject: [PATCH] Use mate or show! in irb to open in EDITOR --- lib/sinatra/test_methods.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/lib/sinatra/test_methods.rb b/lib/sinatra/test_methods.rb index 8ceb51498e..fdd20dd927 100644 --- a/lib/sinatra/test_methods.rb +++ b/lib/sinatra/test_methods.rb @@ -13,6 +13,25 @@ def #{verb}_it(path, params = {}) end end_eval end + + def show!(editor = nil) + editor = editor || ENV['EDITOR'] + IO.popen(editor, 'w') do |f| + f.puts "" + f.puts + f.puts body + end + end + alias :mate :show! + + def result_info + info = <<-end_info + # Status: #{status} + # Headers: #{headers.inspect} + end_info + end def response @response || Rack::MockResponse.new(404, {}, '')