Sha256: bb1a913db49c439bb462f6fb6c6c5403a764a4a3dcf1c79de6b9276b5bc81282

Contents?: true

Size: 687 Bytes

Versions: 2

Compression:

Stored size: 687 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" }

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

  assert_equal ["application/xml"], resp.body
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

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

  assert_equal ["Default action"], resp.body
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cuba-3.0.0.rc2 test/accept.rb
cuba-3.0.0.rc1 test/accept.rb