Sha256: 86b04b16ff78bc2fb8d2eeeb8b71eedeae0bb05a30b31187f5a521c7f77aca5b

Contents?: true

Size: 1.07 KB

Versions: 5

Compression:

Stored size: 1.07 KB

Contents

require "spec_helper"

describe "dynamic mounting" do
  it "resolves routes from root.rb" do
    http.get "/"
    expect_response "root"
  end

  # mounting not at root level
  it "gets deep route from a root.rb file not mounted at /" do
    http.get "/api/v2"
    expect(http.content).to eq("version" => "v2")
    expect(http.response.headers["content-type"]).to match(/application\/json/)
  end

  it "gets deep route from static file" do
    http.get "/api/v2/api.js"
    expect_response /API example file/
    expect(http.response.headers["content-type"]).to match(/application\/javascript/)
  end

  it "gets deep route from non-root.rb file" do
    http.get "/api/v2/jobs/info"
    expect_response "info"
    expect(http.response.headers["content-type"]).to match(/text\/plain/)
  end

  it "gets deep route with params from non-root.rb file" do
    http.get "/api/v2/jobs/12/events"
    expect(http.response.headers["content-type"]).to match(/application\/json/)
    expect(http.content).to eq([{ "job_id" => "12", "id" => "event1" }, { "job_id" => "12", "id" => "event2" }])
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
simple-httpd-0.3.5 spec/simple/httpd/dynamic_mounting_spec.rb
simple-httpd-0.3.4 spec/simple/httpd/dynamic_mounting_spec.rb
simple-httpd-0.3.3 spec/simple/httpd/dynamic_mounting_spec.rb
simple-httpd-0.3.1 spec/simple/httpd/dynamic_mounting_spec.rb
simple-httpd-0.3.0 spec/simple/httpd/dynamic_mounting_spec.rb