Skip to content

Commit

Permalink
chore: Update puma, jquery for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
route committed Nov 7, 2023
1 parent 46857b4 commit 9d0afc0
Show file tree
Hide file tree
Showing 10 changed files with 26 additions and 35 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ gem "chunky_png", "~> 1.3"
gem "image_size", "~> 2.0"
gem "kramdown", "~> 2.0", require: false
gem "pdf-reader", "~> 2.2"
gem "puma", "~> 4.1"
gem "puma", ">= 5.6.7"
gem "rake", "~> 13.0"
gem "redcarpet", require: false, platform: :mri
gem "rspec", "~> 3.8"
Expand Down
2 changes: 1 addition & 1 deletion spec/frame/runtime_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@

it "adds by path" do
browser.go_to
path = "#{Ferrum::Application::FERRUM_PUBLIC}/jquery-1.11.3.min.js"
path = "#{Ferrum::Application::FERRUM_PUBLIC}/jquery-3.7.1.min.js"
expect do
browser.evaluate("$('a').first().text()")
end.to raise_error(Ferrum::JavaScriptError)
Expand Down
8 changes: 4 additions & 4 deletions spec/network/response_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@
expect(responses[0].body).to include("ferrum with_js")

expect(responses[1].url).to end_with("/ferrum/jquery.min.js")
expect(responses[1].body).to include("jQuery v1.11.3")
expect(responses[1].body).to include("jQuery v3.7.1")

expect(responses[2].url).to end_with("/ferrum/jquery-ui.min.js")
expect(responses[2].body).to include("jQuery UI - v1.11.4")
expect(responses[2].body).to include("jQuery UI - v1.13.2")

expect(responses[3].url).to end_with("/ferrum/test.js")
expect(responses[3].body).to include("This is test.js file content")
Expand Down Expand Up @@ -87,8 +87,8 @@
page.go_to("/ferrum/with_js")
responses = traffic.map(&:response)
resources_size = {
%r{/ferrum/jquery.min.js$} => File.size("#{PROJECT_ROOT}/spec/support/public/jquery-1.11.3.min.js"),
%r{/ferrum/jquery-ui.min.js$} => File.size("#{PROJECT_ROOT}/spec/support/public/jquery-ui-1.11.4.min.js"),
%r{/ferrum/jquery.min.js$} => File.size("#{PROJECT_ROOT}/spec/support/public/jquery-3.7.1.min.js"),
%r{/ferrum/jquery-ui.min.js$} => File.size("#{PROJECT_ROOT}/spec/support/public/jquery-ui-1.13.2.min.js"),
%r{/ferrum/test.js$} => File.size("#{PROJECT_ROOT}/spec/support/public/test.js"),
%r{/ferrum/with_js$} => 2312
}
Expand Down
2 changes: 1 addition & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

puts ""
command = Ferrum::Browser::Command.build(Ferrum::Browser::Options.new, nil)
puts `'#{Shellwords.escape(command.path)}' --version`
puts `#{Shellwords.escape(command.path)} --version`
puts ""

RSpec.configure do |config|
Expand Down
4 changes: 2 additions & 2 deletions spec/support/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -262,12 +262,12 @@ def authorized?(login, password)

get "/ferrum/jquery.min.js" do
content_type :js
File.read("#{FERRUM_PUBLIC}/jquery-1.11.3.min.js")
File.read("#{FERRUM_PUBLIC}/jquery-3.7.1.min.js")
end

get "/ferrum/jquery-ui.min.js" do
content_type :js
File.read("#{FERRUM_PUBLIC}/jquery-ui-1.11.4.min.js")
File.read("#{FERRUM_PUBLIC}/jquery-ui-1.13.2.min.js")
end

get "/ferrum/unexist.png" do
Expand Down
5 changes: 0 additions & 5 deletions spec/support/public/jquery-1.11.3.min.js

This file was deleted.

2 changes: 2 additions & 0 deletions spec/support/public/jquery-3.7.1.min.js

Large diffs are not rendered by default.

13 changes: 0 additions & 13 deletions spec/support/public/jquery-ui-1.11.4.min.js

This file was deleted.

6 changes: 6 additions & 0 deletions spec/support/public/jquery-ui-1.13.2.min.js

Large diffs are not rendered by default.

17 changes: 9 additions & 8 deletions spec/support/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -104,16 +104,17 @@ def middleware
def run
options = { Host: host, Port: port, Threads: "0:4", workers: 0, daemon: false }
config = Rack::Handler::Puma.config(middleware, options)
events = config.options[:Silent] ? ::Puma::Events.strings : ::Puma::Events.stdio
log_writer = config.options[:Silent] ? ::Puma::LogWriter.strings : ::Puma::LogWriter.stdio
config.options[:log_writer] = log_writer

events.log "Starting Puma"
events.log "* Version #{Puma::Const::PUMA_VERSION} , codename: #{Puma::Const::CODE_NAME}"
events.log "* Min threads: #{config.options[:min_threads]}, max threads: #{config.options[:max_threads]}"
log_writer.log "Starting Puma"
log_writer.log "* Version #{Puma::Const::PUMA_VERSION} , codename: #{Puma::Const::CODE_NAME}"
log_writer.log "* Min threads: #{config.options[:min_threads]}, max threads: #{config.options[:max_threads]}"

Puma::Server.new(config.app, events, config.options).tap do |s|
s.binder.parse(config.options[:binds], s.events)
s.min_threads = config.options[:min_threads]
s.max_threads = config.options[:max_threads]
Puma::Server.new(config.app, nil, config.options).tap do |s|
s.binder.parse(config.options[:binds], log_writer)
s.min_threads = config.options[:min_threads] if s.respond_to?(:min_threads=)
s.max_threads = config.options[:max_threads] if s.respond_to?(:max_threads=)
end.run.join
end

Expand Down

0 comments on commit 9d0afc0

Please sign in to comment.