utopia 2.21.0 → 2.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,19 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Released under the MIT License.
4
- # Copyright, 2017-2022, by Samuel Williams.
5
-
6
- require 'bundler/setup'
7
- require 'covered/rspec'
8
- require 'variant'
9
-
10
- Variant.force!(:testing)
11
-
12
- RSpec.configure do |config|
13
- # Enable flags like --only-failures and --next-failure
14
- config.example_status_persistence_file_path = '.rspec_status'
15
-
16
- config.expect_with :rspec do |c|
17
- c.syntax = :expect
18
- end
19
- end
@@ -1,57 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Released under the MIT License.
4
- # Copyright, 2016-2022, by Samuel Williams.
5
-
6
- require 'rack/test'
7
- require 'async/rspec/reactor'
8
-
9
- RSpec.shared_context "website" do
10
- include Rack::Test::Methods
11
-
12
- let(:rackup_path) {File.expand_path('../config.ru', __dir__)}
13
- let(:rackup_directory) {File.dirname(rackup_path)}
14
-
15
- let(:app) {Rack::Builder.parse_file(rackup_path)}
16
- end
17
-
18
- RSpec.shared_examples_for "valid page" do |path|
19
- it "can access #{path}" do
20
- get path
21
-
22
- while last_response.redirect?
23
- follow_redirect!
24
- end
25
-
26
- expect(last_response.status).to be == 200
27
- end
28
- end
29
-
30
- RSpec.shared_context "server" do
31
- include_context "website"
32
- include_context Async::RSpec::Reactor
33
-
34
- before(:all) do
35
- require 'falcon/server'
36
- require 'async/io/unix_endpoint'
37
- require 'benchmark/http/spider'
38
- end
39
-
40
- before do
41
- @endpoint = Async::HTTP::Endpoint.parse("http://localhost", Async::IO::Endpoint.unix("server.ipc"))
42
-
43
- @server_task = reactor.async do
44
- middleware = Falcon::Server.middleware(app)
45
-
46
- server = Falcon::Server.new(middleware, endpoint)
47
-
48
- server.run
49
- end
50
- end
51
-
52
- after do
53
- @server_task.stop
54
- end
55
-
56
- let(:endpoint) {@endpoint}
57
- end
@@ -1,28 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Released under the MIT License.
4
- # Copyright, 2016-2022, by Samuel Williams.
5
-
6
- require_relative 'website_context'
7
-
8
- RSpec.describe "website", timeout: 120 do
9
- include_context "server"
10
-
11
- let(:spider) {Benchmark::HTTP::Spider.new(depth: 128)}
12
- let(:statistics) {Benchmark::HTTP::Statistics.new}
13
-
14
- it "should be responsive" do
15
- Async::HTTP::Client.open(endpoint, connection_limit: 8) do |client|
16
- spider.fetch(statistics, client, endpoint.url) do |method, uri, response|
17
- if response.failure?
18
- Console.logger.error(endpoint) {"#{method} #{uri} -> #{response.status}"}
19
- end
20
- end.wait
21
- end
22
-
23
- statistics.print
24
-
25
- expect(statistics.samples).to be_any
26
- expect(statistics.failed).to be_zero
27
- end
28
- end