Sha256: 944785c058c3606558ccbd39039d4d5cb940053abf77d7578f755e281d9bb931

Contents?: true

Size: 1.2 KB

Versions: 1

Compression:

Stored size: 1.2 KB

Contents

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


describe "OptionsfulDocs" do

  include Rack::Test::Methods


  describe "as a Rack middleware" do

    it "is a Ruby object that responds to call;" do
      assert OptionsfulDocs.new(app).respond_to? :call
    end

    it "takes exactly one argument, (the environment) and returns an Array;" do
      response = OptionsfulDocs.new(app).call(mock_env({"REQUEST_METHOD" => "GET", "PATH_INFO" => "/opts/"}))
      assert response.kind_of?(Array)
    end

    it "the returned Array must have exactly three values: the status, the headers and the body;" do
      response = OptionsfulDocs.new(app).call(mock_env({"REQUEST_METHOD" => "GET", "PATH_INFO" => "/opts/"}))
      assert response.size.should == 3
      assert response[0].kind_of? Fixnum 
      assert response[1].kind_of? Hash
      assert response[2].kind_of? String
    end

    it "must be nice, acting somewhere on a Rack middleware stack." do
      response = fake_docs_app.call(mock_env({"REQUEST_METHOD" => "GET", "PATH_INFO" => "/opts/"}))
      assert response.size.should == 3
      assert response[0].kind_of? Fixnum
      assert response[0].should == 200
      assert response[1].kind_of? Hash
    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
optionsful-0.1.5 spec/optionsful_docs_spec.rb