Sha256: 00150636ad5f7e0b08b0a4eb31d532ffb51155f4b192e5a86a1be2ececb908d6

Contents?: true

Size: 682 Bytes

Versions: 21

Compression:

Stored size: 682 Bytes

Contents

require File.expand_path("helper", File.dirname(__FILE__))

test "accept mimetypes" do
  Cuba.define do
    on accept("application/xml") do
      res.write res["Content-Type"]
    end
  end

  env = { "HTTP_ACCEPT" => "application/xml",
          "SCRIPT_NAME" => "/", "PATH_INFO" => "/post" }

   _, _, body = Cuba.call(env)

  assert_response body, ["application/xml"]
end

test "tests don't fail when you don't specify an accept type" do
  Cuba.define do
    on accept("application/xml") do
      res.write res["Content-Type"]
    end

    on default do
      res.write "Default action"
    end
  end

  _, _, body = Cuba.call({})

  assert_response body, ["Default action"]
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
cuba-3.0.0.rc3 test/accept.rb