Skip to content

Commit

Permalink
spec: Support ruby 3.1 and 3.3 error message formats
Browse files Browse the repository at this point in the history
This message is different for ruby 3.3 and 3.1

Change phrase to be the common factor for both ruby versions
  • Loading branch information
kbrock committed Sep 20, 2024
1 parent 8d1110d commit 02a88ad
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions spec/models/mixins/process_tasks_mixin_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -257,12 +257,12 @@ def test_method
expect(api_collection).to receive(:find).with(0).and_return(Struct.new(:id).new(0))
expect(api_collection).to receive(:find).with(1).and_return(double("Something that responds", :id => 0, :the_task => nil))

expect($log).to receive(:error).with(a_string_including("undefined method `the_task' for #<struct id=0>")).and_call_original
expect($log).to receive(:error).with(a_string_matching(/undefined method `the_task' for/)).and_call_original
expect(test_class.invoke_api_tasks(api_connection, :ids => [0, 1], :task => "the_task")).to eq([0, 1])
end

it "collection" do
expect($log).to receive(:error).with(a_string_including("undefined method `the_task' for []:Array")).and_call_original
expect($log).to receive(:error).with(a_string_matching(/undefined method `the_task' for/)).and_call_original
expect { test_class.invoke_api_tasks(api_connection, :task => "the_task") }.not_to raise_error
end
end
Expand Down

0 comments on commit 02a88ad

Please sign in to comment.