Sha256: a3c17675f9c6ec6fa882897c8e27d85a9ce691595b8b78dcb64115096948acf0

Contents?: true

Size: 940 Bytes

Versions: 25

Compression:

Stored size: 940 Bytes

Contents

require File.join(File.dirname(__FILE__), 'test_helper')

describe ApipieBindings::Route do

  let(:route) { ApipieBindings::Route.new("/api/architectures/:id", "GET") }
  it "should list params in path" do
    route.params_in_path.must_equal ['id']
  end

  it "should downcase the method" do
    route.method.must_equal 'get'
  end

  it "should fill in the params" do
    route.path({ "id" => 1 }).must_equal "/api/architectures/1"
  end

  it "should fill in the params as symbols" do
    route.path({ :id => 1 }).must_equal "/api/architectures/1"
  end

  it "should return the path as is without the params" do
    route.path.must_equal "/api/architectures/:id"
  end

  it "should have path visible in puts" do
    out, err = capture_io { puts route }
    out.must_equal "<Route /api/architectures/:id>\n"
  end

  it "should have path visible in inspect" do
    route.inspect.must_equal "<Route /api/architectures/:id>"
  end


end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
apipie-bindings-0.3.0 test/unit/route_test.rb
apipie-bindings-0.2.3 test/unit/route_test.rb
apipie-bindings-0.2.2 test/unit/route_test.rb
apipie-bindings-0.2.1 test/unit/route_test.rb
apipie-bindings-0.2.0 test/unit/route_test.rb
apipie-bindings-0.1.0 test/unit/route_test.rb
apipie-bindings-0.0.19 test/unit/route_test.rb
apipie-bindings-0.0.18 test/unit/route_test.rb
apipie-bindings-0.0.17 test/unit/route_test.rb
apipie-bindings-0.0.16 test/unit/route_test.rb
apipie-bindings-0.0.15 test/unit/route_test.rb
apipie-bindings-0.0.14 test/unit/route_test.rb
apipie-bindings-0.0.13 test/unit/route_test.rb
apipie-bindings-0.0.12 test/unit/route_test.rb
apipie-bindings-0.0.11 test/unit/route_test.rb
apipie-bindings-0.0.10 test/unit/route_test.rb
apipie-bindings-0.0.9 test/unit/route_test.rb
apipie-bindings-0.0.8 test/unit/route_test.rb
apipie-bindings-0.0.7 test/unit/route_test.rb
apipie-bindings-0.0.6 test/unit/route_test.rb