Skip to content
This repository was archived by the owner on Nov 30, 2024. It is now read-only.

Commit 1fb220e

Browse files
committed
Handle false failure due to Ruby 3.4 printing module name
1 parent 874223b commit 1fb220e

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

spec/rspec/core/formatters/base_text_formatter_spec.rb

+8-2
Original file line numberDiff line numberDiff line change
@@ -201,15 +201,15 @@ def run_all_and_dump_failures
201201
it "does not show the error class" do
202202
group.example("example name") { expect("this").to eq("that") }
203203
run_all_and_dump_failures
204-
expect(formatter_output.string).not_to match(/RSpec::/m)
204+
expect(formatter_output_without_formatter_module).not_to match(/RSpec::/m)
205205
end
206206
end
207207

208208
context "with a failed message expectation (rspec-mocks)" do
209209
it "does not show the error class" do
210210
group.example("example name") { expect("this").to receive("that") }
211211
run_all_and_dump_failures
212-
expect(formatter_output.string).not_to match(/RSpec::/m)
212+
expect(formatter_output_without_formatter_module).not_to match(/RSpec::/m)
213213
end
214214
end
215215

@@ -293,4 +293,10 @@ def run_all_and_dump_failures
293293
expect(formatter_output.string).to include("\e[36m")
294294
end
295295
end
296+
297+
# Ruby 3.4 includes modules names in stack traces but two of our tests are looking for RSpec module names, remove
298+
# this one as it is considered 'safe'
299+
def formatter_output_without_formatter_module
300+
formatter_output.string.tr('RSpec::ExampleGroups::RSpecCoreFormattersBaseTextFormatter::DumpFailures#','')
301+
end
296302
end

0 commit comments

Comments
 (0)