Sha256: cc1090af00febd041d48803f4f6e8c703d33f74f978f3ef8e0051a26e09b6671
Contents?: true
Size: 1.22 KB
Versions: 3
Compression:
Stored size: 1.22 KB
Contents
# frozen_string_literal: true RSpec.describe "Early Hints", type: :integration do it "pushes assets" do skip "curl not installed" if which("curl").nil? with_project("bookshelf", server: :puma) do generate "action web home#index --url=/" write "apps/web/assets/javascripts/app.css", <<~EOF body { margin: 0; } EOF inject_line_after "apps/web/templates/app.html.erb", /favicon/, %(<%= stylesheet "app" %>) inject_line_after "config/environment.rb", /mount/, "early_hints true" write "config/puma.rb", <<~EOF early_hints true EOF port = RSpec::Support::RandomPort.call server(port: port) do sleep 2 # The Ruby HTTP client that we use for testing (excon), fails to connect to the server. # It's very likely that it assumes that for each request, the server will return only one response. # But in case of Early Hints (103) the returned response are multiple: `n` Early Hints (103) + OK (200). # # For this reason we fall back to cURL for this test. system_exec("curl -i -v http://localhost:#{port}/") expect(out).to include("Link: </assets/app.css>; rel=preload; as=style") end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
hanami-2.0.0.beta2 | spec/integration/early_hints_spec.rb |
hanami-2.0.0.beta1.1 | spec/integration/early_hints_spec.rb |
hanami-2.0.0.beta1 | spec/integration/early_hints_spec.rb |