Sha256: c7a428727a8108e75ef50aa1c5b1774d158619954d8d116d1fca039830859074
Contents?: true
Size: 616 Bytes
Versions: 2
Compression:
Stored size: 616 Bytes
Contents
require "cuba/test" require_relative "../lib/send_file" FILE = File.join(__dir__, "foo.txt") Cuba.plugin(SendFile) Cuba.define do on root do send_file(FILE) end end scope do test "sends the contents of the file" do get "/" assert_equal 200, last_response.status assert_equal "Hello World\n", last_response.body end test "sets response headers" do get "/" assert_equal "text/plain", last_response["Content-Type"] assert_equal "Hello World\n".length.to_s, last_response["Content-Length"] assert_equal File.mtime(FILE).httpdate, last_response["Last-Modified"] end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
send_file-1.0.1 | test/cuba.rb |
send_file-1.0.0 | test/cuba.rb |