Sha256: 022cd0019e1f8a9850cbf1a22eca1c9325978b0b4386b11ae9be9be569d5878b
Contents?: true
Size: 792 Bytes
Versions: 31
Compression:
Stored size: 792 Bytes
Contents
Given /^the following Rack app:$/ do |definition| File.open(RACK_FILE, 'w') { |file| file.write(definition) } end When /^I perform a Rack request to "([^\"]*)"$/ do |url| shim_file = File.join(PROJECT_ROOT, 'features', 'support', 'honeybadger_shim.rb.template') request_file = File.join(TEMP_DIR, 'rack_request.rb') File.open(request_file, 'w') do |file| file.puts "require 'rubygems'" file.puts IO.read(shim_file) file.puts IO.read(RACK_FILE) file.puts "env = Rack::MockRequest.env_for(#{url.inspect})" file.puts "status, headers, body = app.call(env)" file.puts %{puts "HTTP \#{status}"} file.puts %{headers.each { |key, value| puts "\#{key}: \#{value}"}} file.puts "body.each { |part| print part }" end step %(I run `ruby #{request_file}`) end
Version data entries
31 entries across 31 versions & 1 rubygems