Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to mini_mime gem from mime-types #1884

Merged
merged 1 commit into from
Jun 28, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ Capybara requires Ruby 1.9.3 or later. To install, add this line to your
gem 'capybara'
```

**Note:** If using Ruby < 2.0 you will also need to limit the version of mime-types to < 3.0 and the version of rack to < 2.0
**Note:** If using Ruby < 2.0 you will also need to limit the version of rack to < 2.0

If the application that you are testing is a Rails app, add this line to your test helper file:

Expand Down
2 changes: 1 addition & 1 deletion capybara.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Gem::Specification.new do |s|
s.summary = "Capybara aims to simplify the process of integration testing Rack applications, such as Rails, Sinatra or Merb"

s.add_runtime_dependency("nokogiri", [">= 1.3.3"])
s.add_runtime_dependency("mime-types", [">= 1.16"])
s.add_runtime_dependency("mini_mime", [">= 0.1.3"])
s.add_runtime_dependency("rack", [">= 1.0.0"])
s.add_runtime_dependency("rack-test", [">= 0.5.4"])
s.add_runtime_dependency("xpath", ["~> 2.0"])
Expand Down
3 changes: 1 addition & 2 deletions gemfiles/Gemfile.base-versions
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,11 @@ gem 'nokogiri', '= 1.3.3'
gem 'rspec', '= 2.2.0'
gem 'cucumber', '= 0.10.5'
gem 'tins', '= 1.6.0' # 1.7.0 requires ruby 2.0
gem 'mime-types', '<3.0' # 3.0 require ruby 2.0
gem 'addressable', '< 2.4.0' # 2.4.0 allows require 'addressable' previous don't
gem 'json', '< 2.0'
gem 'rake', '< 11.0'

# We cannot test against older versions of selenium-webdriver without
# installing older compatible Firefox versions.
gem 'selenium-webdriver', '< 3.0.0'
gem 'term-ansicolor', '< 1.4.0'
gem 'term-ansicolor', '< 1.4.0'
3 changes: 1 addition & 2 deletions gemfiles/Gemfile.ruby-19
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ source 'https://rubygems.org'
gem 'bundler', '~> 1.1'
gemspec path: '..'

gem 'mime-types', '< 3.0'
gem 'xpath', :git => 'git://github.com/teamcapybara/xpath.git'

gem 'term-ansicolor', '< 1.4.0'
Expand All @@ -12,4 +11,4 @@ gem 'tins', '< 1.7.0' # 1.7.0 requires ruby 2.0
gem 'selenium-webdriver', '< 3.0.0' # 3.0 requires ruby 2.0
gem 'addressable', '< 2.5.0' # 2.5 requires public_suffix which requires ruby 2.0
gem 'nokogiri', '< 1.7.0' # 1.7 requires ruby 2.1+
gem 'rack', '<2.0' # 2.0 requires ruby 2.2+
gem 'rack', '<2.0' # 2.0 requires ruby 2.2+
2 changes: 1 addition & 1 deletion lib/capybara/rack_test/driver.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true
require 'rack/test'
require 'rack/utils'
require 'mime/types'
require 'mini_mime'
require 'nokogiri'
require 'cgi'

Expand Down
4 changes: 1 addition & 3 deletions lib/capybara/rack_test/form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,7 @@ def params(button)
if (value = field['value']).to_s.empty?
NilUploadedFile.new
else
types = MIME::Types.type_for(value)
content_type = types.sort_by.with_index { |type, idx| [type.obsolete? ? 1 : 0, idx] }.first.to_s
Rack::Test::UploadedFile.new(value, content_type)
Rack::Test::UploadedFile.new(value, MiniMime.lookup_by_filename(value).content_type)
end
merge_param!(params, field['name'].to_s, file)
else
Expand Down