Sha256: 37f555d7e68a9a97a1bdfed85706078fa1a598652c73f2c3b205f4a275fabf8b

Contents?: true

Size: 817 Bytes

Versions: 11

Compression:

Stored size: 817 Bytes

Contents

require 'test_helper'

describe Pliny::Router do

  describe "specifying a version" do
    def app
      Rack::Builder.new do
        use Rack::Lint
        use Pliny::Middleware::Versioning, default: '2', app_name: 'pliny'

        use Pliny::Router do
          version '3' do
            mount Sinatra.new {
              get '/' do
                "API V3"
              end
            }
          end
        end

        run Sinatra.new {
          get "/" do
            "No API"
          end
        }
      end
    end

    it "should not run on any api" do
      get '/'
      assert_equal 'No API', last_response.body
    end

    it "should run on API V3" do
      get '/', {}, {'HTTP_ACCEPT' => 'application/vnd.pliny+json; version=3'}
      assert_equal 'API V3', last_response.body
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
pliny-0.4.0 test/router_test.rb
pliny-0.3.0 test/router_test.rb
pliny-0.2.1 test/router_test.rb
pliny-0.2.0 test/router_test.rb
pliny-0.1.0 test/router_test.rb
pliny-0.0.4 test/router_test.rb
pliny-0.0.3 test/router_test.rb
pliny-0.0.1 test/router_test.rb
pliny-0.0.1.pre3 test/router_test.rb
pliny-0.0.1.pre2 test/router_test.rb
pliny-0.0.1.pre test/router_test.rb