Skip to content

Commit dac8421

Browse files
committed
Add Ruby 4 and stop using minitest/mock for stub
For some reason this stopped working in CI and we don't really need it. I'm not sure why we did it in this way instead of using `mocha` ^_^U Rails still requires it, so let's make sure it's loaded in the test_helper.
1 parent d00184a commit dac8421

File tree

3 files changed

+13
-8
lines changed

3 files changed

+13
-8
lines changed

.github/workflows/main.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ jobs:
1313
with:
1414
ruby-version: 3.4
1515
bundler-cache: true
16+
cache-version: 1
1617
- name: Run rubocop
1718
run: |
1819
bundle exec rubocop --parallel
@@ -29,6 +30,7 @@ jobs:
2930
- 3.2
3031
- 3.3
3132
- 3.4
33+
- 4.0
3234
database: [ mysql, postgres, sqlite ]
3335
gemfile: [ rails_7_1, rails_7_2, rails_8_0, rails_8_1, rails_main ]
3436
exclude:
@@ -64,6 +66,7 @@ jobs:
6466
with:
6567
ruby-version: ${{ matrix.ruby-version }}
6668
bundler-cache: true
69+
cache-version: 1
6770
- name: Update to latest Rails
6871
run: |
6972
bundle update railties

test/models/solid_queue/process_test.rb

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
require "test_helper"
2-
require "minitest/mock"
32

43
class SolidQueue::ProcessTest < ActiveSupport::TestCase
54
test "prune processes with expired heartbeats" do
@@ -58,16 +57,16 @@ class SolidQueue::ProcessTest < ActiveSupport::TestCase
5857

5958
test "hostname's with special characters are properly loaded" do
6059
worker = SolidQueue::Worker.new(queues: "*", threads: 3, polling_interval: 0.2)
61-
hostname = "Basecamps-Computer"
60+
hostname = "Basecamp's-Computer"
6261

63-
Socket.stub :gethostname, hostname.dup.force_encoding("ASCII-8BIT") do
64-
worker.start
65-
wait_for_registered_processes(1, timeout: 1.second)
62+
Socket.stubs(:gethostname).returns(hostname.dup.force_encoding("ASCII-8BIT"))
6663

67-
assert_equal hostname, SolidQueue::Process.last.hostname
64+
worker.start
65+
wait_for_registered_processes(1, timeout: 1.second)
6866

69-
worker.stop
70-
end
67+
assert_equal hostname, SolidQueue::Process.last.hostname
68+
69+
worker.stop
7170
end
7271

7372
test "clear unregistered changes before locking for heartbeat" do

test/test_helper.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# Configure Rails Environment
22
ENV["RAILS_ENV"] = "test"
33

4+
# Ensure minitest gem is loaded before Rails tries to use minitest/mock
5+
require "minitest"
6+
47
require_relative "../test/dummy/config/environment"
58
ActiveRecord::Migrator.migrations_paths = [ File.expand_path("../test/dummy/db/migrate", __dir__) ]
69
require "rails/test_help"

0 commit comments

Comments
 (0)