Skip to content

Commit af1888d

Browse files
committed
fix: prevent RSpec 3.5+ from auto-discovering test example groups
Use anonymous classes instead of RSpec::Core::ExampleGroup.describe() to create example groups for formatter testing. This prevents RSpec 3.5+ from automatically registering and executing these test groups, which was causing false test failures.
1 parent 967278e commit af1888d

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

spec/api_formatter_spec.rb

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,18 @@
22

33
describe RspecApiDocumentation::ApiFormatter do
44
let(:metadata) { {} }
5-
let(:group) { RSpec::Core::ExampleGroup.describe("Orders", metadata) }
5+
let(:group) {
6+
# Create an anonymous class that inherits from ExampleGroup but doesn't auto-register
7+
Class.new(RSpec::Core::ExampleGroup) do
8+
def self.description
9+
"Orders"
10+
end
11+
12+
def self.metadata
13+
{}
14+
end
15+
end
16+
}
617
let(:output) { StringIO.new }
718
let(:formatter) { RspecApiDocumentation::ApiFormatter.new(output) }
819

0 commit comments

Comments
 (0)