Sha256: 6d59131fee3249dd15b6d91e2db5c73350670c8e740a4ee350b71a4fa8faa14c

Contents?: true

Size: 786 Bytes

Versions: 30

Compression:

Stored size: 786 Bytes

Contents

require_relative "spec_helper"

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{|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{|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

30 entries across 30 versions & 1 rubygems

Version Path
roda-3.28.0 spec/composition_spec.rb
roda-3.27.0 spec/composition_spec.rb
roda-3.26.0 spec/composition_spec.rb
roda-3.25.0 spec/composition_spec.rb
roda-3.24.0 spec/composition_spec.rb
roda-3.23.0 spec/composition_spec.rb
roda-3.22.0 spec/composition_spec.rb
roda-3.21.0 spec/composition_spec.rb
roda-3.20.0 spec/composition_spec.rb
roda-3.19.0 spec/composition_spec.rb
roda-3.18.0 spec/composition_spec.rb
roda-3.17.0 spec/composition_spec.rb
roda-3.16.0 spec/composition_spec.rb
roda-3.15.0 spec/composition_spec.rb
roda-3.14.1 spec/composition_spec.rb
roda-3.14.0 spec/composition_spec.rb
roda-3.13.0 spec/composition_spec.rb
roda-3.12.0 spec/composition_spec.rb
roda-3.11.0 spec/composition_spec.rb
roda-3.10.0 spec/composition_spec.rb