Sha256: 480713327be84d4658035b21bb90fc1395d34a72b4745a8d918754c0799ece4f

Contents?: true

Size: 734 Bytes

Versions: 1

Compression:

Stored size: 734 Bytes

Contents

describe 'config server' do
  include_context :integration
  include_context :sitehub_json

  let(:config) do
    { proxies: [
      {
        path: '%r{/regex(.*)}',
        default: DOWNSTREAM_URL
      }
    ] }
  end

  let(:downstream_response) { 'downstream response' }

  before do
    stub_request(:get, CONFIG_SERVER_URL).and_return(body: config.to_json)
    stub_request(:get, DOWNSTREAM_URL).and_return(body: downstream_response)
  end

  let(:app) do
    sitehub = sitehub do
      config_server(CONFIG_SERVER_URL, caching_options: { expires_in: 1 })
    end

    Async::Middleware.new(sitehub)
  end

  it 'path as regex' do
    get('/regex123')

    expect(app.last_response.body).to eq([downstream_response])
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sitehub-0.5.0.alpha10 spec/integration/config_server_spec.rb