Sha256: 371cb06e689d6657b75652f8829f76bc550e4c775609816cfbdb13dd39fa8605

Contents?: true

Size: 850 Bytes

Versions: 13

Compression:

Stored size: 850 Bytes

Contents

require_relative "helper"

test do
  class UserPhotos < Cuba
    define do
      on root do
        res.write "uid: %d" % vars[:user_id]
        res.write "site: %s" % vars[:site]
      end
    end
  end

  class Photos < Cuba
    define do
      on ":id/photos" do |id|
        with user_id: id do
          _, _, body = UserPhotos.call(req.env)

          body.each do |line|
            res.write line
          end
        end

        res.write vars.inspect
      end
    end
  end

  Cuba.define do
    on "users" do
      with user_id: "default", site: "main" do
        run Photos
      end
    end
  end

  _, _, body = Cuba.call({ "PATH_INFO" => "/users/1001/photos",
                           "SCRIPT_NAME" => "" })

  assert_response body, ["uid: 1001", "site: main",
                         '{:user_id=>"default", :site=>"main"}']
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
cuba-4.0.3 test/with.rb
cuba-4.0.1 test/with.rb
cuba-4.0.0 test/with.rb
cuba-3.9.3 test/with.rb
cuba-3.9.2 test/with.rb
cuba-3.9.1 test/with.rb
cuba-3.9.0 test/with.rb
cuba-3.8.1 test/with.rb
cuba-3.8.0 test/with.rb
cuba-3.7.0 test/with.rb
cuba-3.6.0 test/with.rb
cuba-3.5.0 test/with.rb
cuba-3.4.0 test/with.rb