Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,15 @@ jobs:
continue-on-error: ${{ endsWith(matrix.ruby, 'head') || matrix.ruby == 'debug' }}
steps:
- uses: actions/checkout@v3
- name: Set up Ruby 3.4 for test server
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.4'
- name: Start test server
run: |
ruby spec/support/server.rb &
sleep 5
curl -f http://localhost:3001/ || (sleep 5 && curl -f http://localhost:3001/)
- name: Install libcurl header
run: |
if ${{ matrix.os == 'macos' }}
Expand Down
12 changes: 0 additions & 12 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,6 @@ gem "rake"

group :development, :test do
gem "rspec", "~> 3.4"

if Gem.ruby_version < Gem::Version.new("3.0.0")
gem "sinatra", "~> 2.2"
else
gem "sinatra"
end

gem "rackup"
gem "json"
gem "mime-types", "~> 1.18"
gem "mustermann"
gem "webrick"
end

group :perf do
Expand Down
11 changes: 0 additions & 11 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,6 @@
require "ethon"
require 'rspec'

require_relative 'support/localhost_server'
require_relative 'support/server'

# Ethon.logger = Logger.new($stdout).tap do |log|
# log.level = Logger::DEBUG
# end

RSpec.configure do |config|
# config.order = :rand

config.before(:suite) do
LocalhostServer.new(TESTSERVER.new, 3001)
end
end
109 changes: 0 additions & 109 deletions spec/support/localhost_server.rb

This file was deleted.

23 changes: 23 additions & 0 deletions spec/support/server.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

require 'bundler/inline'

gemfile do
source 'https://rubygems.org'
gem 'sinatra'
gem 'rackup'
gem 'webrick'
end

require 'json'
require 'zlib'
require 'sinatra/base'
require 'webrick'
require 'rackup'

TESTSERVER = Sinatra.new do
use Rack::RewindableInput::Middleware if defined?(Rack::RewindableInput::Middleware)
Expand Down Expand Up @@ -115,3 +127,14 @@
request.env.merge!(:body => request.body.tap {|b| b.rewind }.read).to_json
end
end

puts "Starting test server on port 3001..."

options = {
:Port => 3001,
:Host => 'localhost',
:AccessLog => [],
:Logger => WEBrick::BasicLog.new(StringIO.new)
}

Rackup::Handler::WEBrick.run(TESTSERVER, **options)