Sha256: d9b3b9dd50a151cdd5cfda9909b7c6d8df06ff5066bcf45596294243c7d3fbcc

Contents?: true

Size: 918 Bytes

Versions: 2

Compression:

Stored size: 918 Bytes

Contents

#
# Testing rufus-verbs
#
# jmettraux@gmail.com
#
# Sun Jan 13 20:02:25 JST 2008
#


require File.dirname(__FILE__) + '/base.rb'


class BlockTest < Test::Unit::TestCase
  include TestBaseMixin

  include Rufus::Verbs


  def test_0

    res = post :uri => "http://localhost:7777/items/0" do
      "Fedor" +
      "Fedorovitch"
    end
    assert_equal 201, res.code.to_i
    assert_equal "http://localhost:7777/items/0", res['Location']


    expect(
      200,
      { 0 => "FedorFedorovitch" },
      get(:uri => "http://localhost:7777/things"))

    res = post :uri => "http://localhost:7777/items/1" do |req|
      # do whatever with the request [headers]
      "John"
    end
    assert_equal 201, res.code.to_i
    assert_equal "http://localhost:7777/items/1", res['Location']

    expect(
      200,
      { 0 => "FedorFedorovitch", 1 => "John" },
      get(:uri => "http://localhost:7777/things"))
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rufus-verbs-1.0.1 test/block_test.rb
rufus-verbs-1.0.0 test/block_test.rb