Module: AvroTurf::Test::FakeServer

Included in:
FakeConfluentSchemaRegistryServer
Defined in:
lib/avro_turf/test/fake_server.rb

Overview

A lightweight Rack-based router module that provides Sinatra-like DSL. This module is designed to replace Sinatra::Base for the fake schema registry servers used in testing, eliminating the sinatra dependency.

Usage:

class MyServer
  include AvroTurf::Test::FakeServer

  get "/path/:param" do
    { result: params[:param] }.to_json
  end

  post "/other" do
    halt(404, '{"error": "not found"}') if some_condition
    '{"ok": true}'
  end
end

Defined Under Namespace

Modules: ClassMethods, InstanceMethods

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



32
33
34
35
# File 'lib/avro_turf/test/fake_server.rb', line 32

def self.included(base)
  base.extend(ClassMethods)
  base.include(InstanceMethods)
end