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.9.2 test/accept.rb
cuba-3.9.1 test/accept.rb
cuba-3.9.0 test/accept.rb
cuba-3.8.1 test/accept.rb
cuba-3.8.0 test/accept.rb
cuba-3.7.0 test/accept.rb
cuba-3.6.0 test/accept.rb
cuba-3.5.0 test/accept.rb
cuba-3.4.0 test/accept.rb
cuba-3.3.0 test/accept.rb
cuba-3.2.0 test/accept.rb
cuba-3.1.1 test/accept.rb
cuba-3.1.0 test/accept.rb
cuba-3.1.0.rc2 test/accept.rb
cuba-3.1.0.rc1 test/accept.rb
cuba-3.0.1.rc2 test/accept.rb
cuba-3.0.1.rc1 test/accept.rb
cuba-3.0.0 test/accept.rb
cuba-3.0.0.rc5 test/accept.rb
cuba-3.0.0.rc4 test/accept.rb