Sha256: 50e0d391a43d7937619746aeeb05320ab328febc9402f2fb4753f66406346401

Contents?: true

Size: 877 Bytes

Versions: 2

Compression:

Stored size: 877 Bytes

Contents

require "spec_helper"

describe Rack::API::Runner do
  it "responds to http methods" do
    subject.should respond_to(:get)
    subject.should respond_to(:post)
    subject.should respond_to(:put)
    subject.should respond_to(:delete)
    subject.should respond_to(:head)
  end

  it "sets available formats" do
    subject.respond_to(:json, :jsonp, :atom)
    subject.option(:formats).should == [:json, :jsonp, :atom]
  end

  it "sets prefix option" do
    subject.prefix("my/awesome/api")
    subject.option(:prefix).should == "my/awesome/api"
  end

  it "stores middleware" do
    subject.use Rack::Auth::Basic
    subject.option(:middlewares, :merge).should == [[Rack::Auth::Basic]]
  end

  it "stores basic auth info" do
    handler = proc {}

    subject.basic_auth("Get out!", &handler)
    subject.settings[:global][:auth].should == ["Get out!", handler]
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rack-api-0.1.2 spec/rack-api/runner_spec.rb
rack-api-0.1.1 spec/rack-api/runner_spec.rb