Sha256: eb0e87b070a031a333f77a9bd6b6f0212bfe77aec0a665685d5cf35ae35a2a06

Contents?: true

Size: 654 Bytes

Versions: 12

Compression:

Stored size: 654 Bytes

Contents

require "spec_helper"

describe Rack::API, "Paths" do
   before do
    Rack::API.app do
      version :v1 do
        prefix "api"
        get("users") { {:users => []} }
      end

      version :v2 do
        prefix "/"
        get("users") { {:users => []} }
      end
    end
  end

  it "does not render root" do
    get "/"
    last_response.status.should == 404
  end

  it "does not render unknown paths" do
    get "/api/v1/users/index"
    last_response.status.should == 404
  end

  it "renders known paths" do
    get "/api/v1/users"
    last_response.status.should == 200

    get "/v2/users"
    last_response.status.should == 200
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
rack-api-1.1.0 spec/rack-api/paths_spec.rb
rack-api-1.0.2 spec/rack-api/paths_spec.rb
rack-api-1.0.1 spec/rack-api/paths_spec.rb
rack-api-1.0.0 spec/rack-api/paths_spec.rb
rack-api-0.3.1 spec/rack-api/paths_spec.rb
rack-api-0.3.0 spec/rack-api/paths_spec.rb
rack-api-0.2.2 spec/rack-api/paths_spec.rb
rack-api-0.2.1 spec/rack-api/paths_spec.rb
rack-api-0.2.0 spec/rack-api/paths_spec.rb
rack-api-0.1.2 spec/rack-api/paths_spec.rb
rack-api-0.1.1 spec/rack-api/paths_spec.rb
rack-api-0.1.0 spec/rack-api/paths_spec.rb