Skip to content

Commit

Permalink
Test with Ruby 3.2 and 3.3 (#120)
Browse files Browse the repository at this point in the history
  • Loading branch information
dan-manges committed Feb 19, 2024
1 parent c72d902 commit 78285a6
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,13 @@ jobs:
rspec-matrix:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ruby:
- '3.0'
- '3.1'
- '3.2'
- '3.3'
gemfile:
- '3.8'
- '3.9'
Expand Down
2 changes: 1 addition & 1 deletion bin/check_num_tests.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
EXPECTED_TEST_NUMBER_SNAPSHOT_PATH = 'spec/NUM_TESTS'

json_path = ARGV[0] || DEFAULT_TEST_JSON_PATH
unless File.exists?(json_path)
unless File.exist?(json_path)
warn "no test file found at #{json_path}"
warn "usage: bin/snapshot_num_tests.rb (path to json file) (default: #{DEFAULT_TEST_JSON_PATH}"
exit 1
Expand Down
1 change: 1 addition & 0 deletions spec/features/integration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ def sanitize_backtrace(output)
.gsub(%r{^\s+# [^\s]+/(?:bin|bundler|rubygems|gems)/.+$\n}, "") # get rid of backtraces outside of rspec-abq
.gsub(%r{^\s*"[^\s]+/(?:bin|bundler|rubygems|gems)/.+",?$}, "") # get rid of backtraces outside of rspec-abq in pretty JSON
.gsub(%r{\\n\s+(?:\\u001b\[36m)?# [^\s]+/(?:bin|bundler|rubygems|gems)/.+\\n}, "") # get rid of backtraces outside of rspec-abq in escaped strings
.gsub(%r{^\s*"<internal:kernel>:187:in\s+`loop'",\n}, "") # this is showing up on select version combinations of ruby and rspec
.gsub(/\.rb:\d+/, ".rb:0") # get rid of line numbers to avoid unecessary test churn
end

Expand Down
8 changes: 8 additions & 0 deletions spec/rspec/abq_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,14 @@ def stringify_keys(hash)
end

it "fails with ConnectionFailed when connection times out", aggregate_failures: true do
ruby_3_2_or_greater = Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.2.0")
if ruby_3_2_or_greater && RSpec::Core::Version::STRING == "3.10.2"
pending "This is failing on RSpec 3.10 but passing on 3.8, 3.9, and 3.11+. Assuming bug in that verison of RSpec."
# The failure is.
# #<Socket (class)> received :tcp with unexpected arguments
# expected: ("127.0.0.1", "43809", {:connect_timeout=>1})
# got: ("127.0.0.1", "43809", {:connect_timeout=>1})
end
# Force this error to avoid flakiness.
expect(Socket).to receive(:tcp).with(host, port.to_s, connect_timeout: 0.001)
.and_raise(Errno::ETIMEDOUT, "forced error")
Expand Down

0 comments on commit 78285a6

Please sign in to comment.