Skip to content

Commit

Permalink
Limit Rack::Lint::InputWrapper test to Rack 2
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremy committed Mar 1, 2024
1 parent 2bbfd78 commit ccd4be5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
4 changes: 2 additions & 2 deletions marcel.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Gem::Specification.new do |spec|

spec.add_development_dependency 'minitest', '~> 5.11'
spec.add_development_dependency 'bundler', '>= 1.7'
spec.add_development_dependency 'rake', '~> 13.0'
spec.add_development_dependency 'rack', '~> 2.0'
spec.add_development_dependency 'rake', '>= 13.0'
spec.add_development_dependency 'rack', '>= 2'
spec.add_development_dependency 'nokogiri', '>= 1.9.1'
end
13 changes: 11 additions & 2 deletions test/mime_type_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,19 @@ def setup
assert_equal "image/gif", content_type
end

test "gets content type from sources that conform to Rack::Lint::InputWrapper" do
test "gets content type from sources that conform to Rack RewindableInput" do
io = StringIO.new(File.read(@path))
wrapper = Rack::Lint::InputWrapper.new(io)
wrapper = Rack::RewindableInput.new(io)
content_type = Marcel::MimeType.for wrapper
assert_equal "image/gif", content_type
end

if Rack::Lint.const_defined?(:InputWrapper)
test "gets content type from sources that conform to Rack 2's Rack::Lint::InputWrapper" do
io = StringIO.new(File.read(@path))
wrapper = Rack::Lint::InputWrapper.new(io)
content_type = Marcel::MimeType.for wrapper
assert_equal "image/gif", content_type
end
end
end

0 comments on commit ccd4be5

Please sign in to comment.