Skip to content

Add Ruby 3.4 to CI matrix in GitHub Actions workflow #239

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ jobs:
strategy:
matrix:
ruby-version:
- '3.4'
- '3.3'
- '3.2'
- '3.1'
Expand Down
1 change: 1 addition & 0 deletions rspec-sidekiq.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Gem::Specification.new do |s|
s.add_development_dependency "activemodel"
s.add_development_dependency "activesupport"
s.add_development_dependency "railties"
s.add_development_dependency "ostruct"

s.files = `git ls-files -- lib/*`.split("\n")
s.files += %w[CHANGES.md LICENSE README.md]
Expand Down
16 changes: 8 additions & 8 deletions spec/rspec/sidekiq/matchers/enqueue_sidekiq_job_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
lines = error.message.split("\n")
expect(lines).to include(
match(/expected to enqueue a .* job/),
match(/-{"queue"=>"very_high"}/)
match(/-{"queue"\s*=>\s*"very_high"}/)
)
}
end
Expand All @@ -124,7 +124,7 @@
lines = error.message.split("\n")
expect(lines).to include(
match(/expected to enqueue a .* job/),
match(/-{"at"=>#{specific_time.to_i}}/)
match(/-{"at"\s*=>\s*#{specific_time.to_i}}/)
)
}
end
Expand All @@ -137,7 +137,7 @@
lines = error.message.split("\n")
expect(lines).to include(
match(/expected to enqueue a .* job/),
match(/-{"at"=>#{specific_time.to_i}}/)
match(/-{"at"\s*=>\s*#{specific_time.to_i}}/)
)
}
end
Expand All @@ -161,7 +161,7 @@
lines = error.message.split("\n")
expect(lines).to include(
match(/expected to enqueue a .* job/),
match(/-{"at"=>#{1.hour.from_now.to_i}}/)
match(/-{"at"\s*=>\s*#{1.hour.from_now.to_i}}/)
)
}
end
Expand All @@ -173,7 +173,7 @@
lines = error.message.split("\n")
expect(lines).to include(
match(/expected to enqueue a .* job/),
match(/-{"at"=>#{1.hour.from_now.to_i}}/)
match(/-{"at"\s*=>\s*#{1.hour.from_now.to_i}}/)
)
}
end
Expand All @@ -193,7 +193,7 @@
lines = error.message.split("\n")
expect(lines).to include(
match(/expected to enqueue a .* job/),
match(/-{"at"=>nil}/)
match(/-{"at"\s*=>\s*nil}/)
)
}
end
Expand Down Expand Up @@ -243,7 +243,7 @@
lines = error.message.split("\n")
expect(lines).to include(
match(/expected to enqueue a .* job/),
match(/-{"created_at"=>"2024-01-01T00:00:00Z"}/)
match(/-{"created_at"\s*=>\s*"2024-01-01T00:00:00Z"}/)
)
}
end
Expand All @@ -270,7 +270,7 @@
lines = error.message.split("\n")
expect(lines).to include(
match(/expected to enqueue a .* job/),
match(/-{"nested"=>{"option"=>"there"}/)
match(/-{"nested"\s*=>\s*{"option"\s*=>\s*"there"}/)
)
}
end
Expand Down
49 changes: 24 additions & 25 deletions spec/rspec/sidekiq/matchers/have_enqueued_sidekiq_job_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@
lines = error.message.split("\n")
expect(lines).to include(
match(/expected to have enqueued a .* job/),
match(/-{"trace_id"=>"nothing"}/)
match(/-{"trace_id"\s*=>\s*"nothing"}/)
)
}
end
Expand Down Expand Up @@ -195,7 +195,7 @@
lines = error.message.split("\n")
expect(lines).to include(
match(/expected to have enqueued a .* job/),
match(/-{"nested"=>{"option"=>"there"}/)
match(/-{"nested"\s*=>\s*{"option"\s*=>\s*"there"}/)
)
}
end
Expand Down Expand Up @@ -351,22 +351,20 @@
it 'returns description' do
worker.perform_async(*worker_args)
argument_subject.matches? worker
expect(argument_subject.description).to eq %{have enqueued a #{worker} job with arguments [\"string\", 1, true, {\"key\"=>\"value\", \"bar\"=>\"foo\", \"nested\"=>[{\"hash\"=>true}]}]}
expected_args = ["string", 1, true, {"key"=>"value", "bar"=>"foo", "nested"=>[{"hash"=>true}]}]
args_string = expected_args.inspect
expect(argument_subject.description).to eq %{have enqueued a #{worker} job with arguments #{args_string}}
end
end

describe '#failure_message' do
it 'returns message' do
jid = worker.perform_async(*worker_args)
argument_subject.matches? worker
expect(argument_subject.failure_message).to eq <<~eos.strip
expected to have enqueued a #{worker} job
with arguments:
-["string", 1, true, {"bar"=>"foo", "key"=>"value", "nested"=>[{"hash"=>true}]}]
but enqueued only jobs
-JID:#{jid} with arguments:
-["string", 1, true, {"bar"=>"foo", "key"=>"value", "nested"=>[{"hash"=>true}]}]
eos
expect(argument_subject.failure_message).to match(/expected to have enqueued a #{worker} job/)
expect(argument_subject.failure_message).to match(/with arguments:\s*-\[.*"string".*1.*true.*\]/)
expect(argument_subject.failure_message).to match(/but enqueued only jobs/)
expect(argument_subject.failure_message).to match(/JID:#{jid} with arguments:\s*-\[.*"string".*1.*true.*\]/)
end

context "when expected arguments is an array and multiple jobs enqueued" do
Expand All @@ -376,16 +374,15 @@
it "returns a message showing the wrapped array in expectations but each job on its own line" do
jids = 2.times.map { worker.perform_async(*worker_args) }
argument_subject.matches? worker
expect(argument_subject.failure_message).to eq <<~eos.strip
expected to have enqueued a #{worker} job
with arguments:
-[["string", 1, true, {"bar"=>"foo", "key"=>"value", "nested"=>[{"hash"=>true}]}]]
but enqueued only jobs
-JID:#{jids[0]} with arguments:
-["string", 1, true, {"bar"=>"foo", "key"=>"value", "nested"=>[{"hash"=>true}]}]
-JID:#{jids[1]} with arguments:
-["string", 1, true, {"bar"=>"foo", "key"=>"value", "nested"=>[{"hash"=>true}]}]
eos
message = argument_subject.failure_message
expect(message).to match(/expected to have enqueued a #{worker} job/)
expect(message).to match(/with arguments:\s*-\[\[.*"string".*1.*true.*\]\]/)
expect(message).to match(/but enqueued only jobs/)
expect(message).to match(/JID:#{Regexp.escape(jids[0])} with arguments:\s*-\[.*"string".*1.*true.*\]/)
expect(message).to match(/JID:#{Regexp.escape(jids[1])} with arguments:\s*-\[.*"string".*1.*true.*\]/)
expect(message).to match(/"bar"\s*=>\s*"foo"/)
expect(message).to match(/"key"\s*=>\s*"value"/)
expect(message).to match(/"nested"\s*=>\s*\[\{"hash"\s*=>\s*true\}\]/)
end
end
end
Expand All @@ -394,10 +391,12 @@
it 'returns message' do
worker.perform_async(*worker_args)
argument_subject.matches? worker
expect(argument_subject.failure_message_when_negated).to eq <<-eos.gsub(/^ {6}/, '').strip
expected not to have enqueued a #{worker} job but enqueued 1
arguments: [\"string\", 1, true, {\"key\"=>\"value\", \"bar\"=>\"foo\", \"nested\"=>[{\"hash\"=>true}]}]
eos
message = argument_subject.failure_message_when_negated
expect(message).to match(/expected not to have enqueued a #{worker} job but enqueued 1/)
expect(message).to match(/arguments: \[.*"string".*1.*true.*\]/)
expect(message).to match(/"key"\s*=>\s*"value"/)
expect(message).to match(/"bar"\s*=>\s*"foo"/)
expect(message).to match(/"nested"\s*=>\s*\[\{"hash"\s*=>\s*true\}\]/)
end
end

Expand Down