Sha256: f9c22f06d21b50a830be86b3522b839266a83cb180a9a12f578d504d704a3a2b

Contents?: true

Size: 948 Bytes

Versions: 1

Compression:

Stored size: 948 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')

describe I::Rack do
  
  def do_call(path, request_method, &block)
    request = Rack::MockRequest.env_for(path, :method => request_method)
    @response = I::Rack.new(block).call(request)    
  end

  %w{POST GET PUT DELETE HEAD}.each do |method|

    describe method do
  
      describe "/flibble" do
      
        before do
          do_call("/flibble", method) { |env| :result  }
        end

        it "forwards the request for processing" do
          @response.should == :result
        end

      end

      describe "/WMD" do
    
        before do
          do_call("/WMD", method) { |env| fail "Should not forward request for processing" }    
        end
    
        it "returns 404 Not Found" do
          @response.should == ["404 Not Found", {"Content-Type" => "text/plain", "Content-Length" => "0"}, []]
        end

      end
      
    end
    
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
i-rack-0.1.0 spec/i-rack/i_spec.rb