Sha256: 7d95cfa4edcf58a7546678e8bb9cccd38775f5a61ec16d3f85aab8057f6e0d03

Contents?: true

Size: 856 Bytes

Versions: 20

Compression:

Stored size: 856 Bytes

Contents

require File.expand_path("spec_helper", File.dirname(__FILE__))

describe "r.run" do
  it "should allow composition of apps" do
    a = app do |r|
      r.on "services/:id" do |id|
        "View #{id}"
      end
    end

    app(:new) do |r|
      r.on "provider" do
        r.run a
      end
    end

    body("/provider/services/101").must_equal 'View 101'
  end

  it "modifies SCRIPT_NAME/PATH_INFO when calling run" do
    a = app{|r| "#{r.script_name}|#{r.path_info}"}
    app(:static_path_info){|r| r.on("a"){r.run a}}
    body("/a/b").must_equal "/a|/b"
  end

  it "restores SCRIPT_NAME/PATH_INFO before returning from run" do
    a = app{|r| "#{r.script_name}|#{r.path_info}"}
    app(:static_path_info){|r| s = catch(:halt){r.on("a"){r.run a}}; "#{s[2].join}%#{r.script_name}|#{r.path_info}"}
    body("/a/b").must_equal "/a|/b%|/a/b"
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
roda-2.21.0 spec/composition_spec.rb
roda-2.20.0 spec/composition_spec.rb
roda-2.19.0 spec/composition_spec.rb
roda-2.18.0 spec/composition_spec.rb
roda-2.17.0 spec/composition_spec.rb
roda-2.16.0 spec/composition_spec.rb
roda-2.15.0 spec/composition_spec.rb
roda-2.14.0 spec/composition_spec.rb
roda-2.13.0 spec/composition_spec.rb
roda-2.12.0 spec/composition_spec.rb
roda-2.11.0 spec/composition_spec.rb
roda-2.10.0 spec/composition_spec.rb
roda-2.9.0 spec/composition_spec.rb
roda-2.8.0 spec/composition_spec.rb
roda-2.7.0 spec/composition_spec.rb
roda-2.6.0 spec/composition_spec.rb
roda-2.5.1 spec/composition_spec.rb
roda-2.5.0 spec/composition_spec.rb
roda-2.4.0 spec/composition_spec.rb
roda-2.3.0 spec/composition_spec.rb