Skip to content

Commit 704da35

Browse files
committed
Rack 3 update: Patch RspecApiDocumentation module
* and add unit test to check rspec_api_documentation Gem version (will fail when Gem is updated)
1 parent d51f68c commit 704da35

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Monkey patch to provide a robust read_request_body helper compatible with Rack 3
2+
# See:
3+
# https://github.com/zipmark/rspec_api_documentation/pull/550
4+
# https://github.com/zipmark/rspec_api_documentation/issues/548
5+
6+
module RspecApiDocumentation
7+
class ClientBase
8+
def read_request_body
9+
input = last_request.env['rack.input'] || StringIO.new
10+
input.rewind
11+
input.read
12+
end
13+
end
14+
end
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
require 'spec_helper'
2+
3+
RSpec.describe 'rspec_api_documentation gem version' do
4+
it 'is pinned to 6.1.0 for the monkey patch compatibility' do
5+
spec = Gem.loaded_specs['rspec_api_documentation']
6+
# Ensure the gem is loaded; spec_helper requires it in init block.
7+
expect(spec).not_to be_nil
8+
expect(spec.version.to_s).to eq('6.1.0')
9+
end
10+
end

0 commit comments

Comments
 (0)