Sha256: e0ef48557e7e15344b2357971525c3d8faaceb97f911f229bb6f75aaf69c64de

Contents?: true

Size: 1.33 KB

Versions: 2

Compression:

Stored size: 1.33 KB

Contents

require 'rfuzz/session'
include RFuzz

context "Serving static files" do
  setup do
    @client = HttpClient.new("localhost", 3000)
  end

  specify "Services index.html by default" do
    default = @client.get("/")
    default.http_status.should_equal "200"

    index = @client.get("/index.html")
    index.http_status.should_equal "200"

    index.http_body.should_equal default.http_body
  end

  specify "Serves static files" do
    railspng = @client.get("/images/rails.png")
    railspng.http_status.should_equal "200"
    railspng.http_body.length.should_equal 1787 
  end


  specify "Proper MIME types" do
    railspng = @client.get("/images/rails.png")
    railspng['CONTENT_TYPE'].should_equal "image/png"

    index = @client.get("/index.html")
    default = @client.get("/")
    default['CONTENT_TYPE'].should_equal index['CONTENT_TYPE']
    default['CONTENT_TYPE'].should_equal "text/html"

    robots = @client.get("/robots.txt")
    robots['CONTENT_TYPE'].should_equal "text/plain"
  end

  specify "404 Missing files" do
    missing = @client.get("/imnothereturdy")
    missing.http_status.should_equal "404"
  end

  specify "Missing Slash then Redirects" do
    # TODO: implement this feature, seems to trip people up
    redir = @client.get("/images")

    redir = @client.get("/javascripts")

    redir = @client.get("/stylesheets")
  end
end


Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rfuzz-0.8 examples/mongrel_test_suite/test/rails/static_files.rb
rfuzz-0.9 examples/mongrel_test_suite/test/rails/static_files.rb