Skip to content

Commit

Permalink
Test against Ruby 2.7
Browse files Browse the repository at this point in the history
  • Loading branch information
mshibuya committed Dec 27, 2019
1 parent e39194f commit 9a37fc9
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 11 deletions.
13 changes: 7 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ language: ruby
cache: bundler

rvm:
- 2.5.5
- 2.6.2
- 2.5.7

This comment has been minimized.

Copy link
@pedrofurtado

pedrofurtado Dec 27, 2019

@mshibuya Could you also publish the compatibility with ruby 2.7 in 1.x releases?

- 2.6.5
- 2.7.0
- jruby-9.2.8.0

gemfile:
Expand All @@ -27,13 +28,13 @@ matrix:
gemfile: gemfiles/rails-5-2.gemfile
- rvm: 2.3.8
gemfile: gemfiles/rails-5-2.gemfile
- rvm: 2.4.5
- rvm: 2.4.9
gemfile: gemfiles/rails-5-2.gemfile
- rvm: 2.5.5
- rvm: 2.5.7
gemfile: gemfiles/rails-5-0.gemfile
- rvm: 2.5.5
- rvm: 2.5.7
gemfile: gemfiles/rails-5-1.gemfile
- rvm: 2.6.2
- rvm: 2.7.0
gemfile: gemfiles/rails-master.gemfile
- rvm: ruby-head
gemfile: gemfiles/rails-6-0.gemfile
Expand Down
2 changes: 1 addition & 1 deletion lib/carrierwave/downloader/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def download(url, remote_headers = {})
def process_uri(uri)
uri_parts = uri.split('?')
encoded_uri = Addressable::URI.parse(uri_parts.shift).normalize.to_s
encoded_uri << '?' << URI.encode(uri_parts.join('?')) if uri_parts.any?
encoded_uri << '?' << Addressable::URI.encode(uri_parts.join('?')).gsub('%5B', '[').gsub('%5D', ']') if uri_parts.any?
URI.parse(encoded_uri)
rescue URI::InvalidURIError, Addressable::URI::InvalidURIError
raise CarrierWave::DownloadError, "couldn't parse URL: #{uri}"
Expand Down
2 changes: 1 addition & 1 deletion lib/carrierwave/mounter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def blank?
end

def remove?
remove.present? && remove !~ /\A0|false$\z/
remove.present? && (remove == true || remove !~ /\A0|false$\z/)
end

def remove!
Expand Down
2 changes: 1 addition & 1 deletion lib/carrierwave/sanitized_file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ def file=(file)
def mkdir!(path, directory_permissions)
options = {}
options[:mode] = directory_permissions if directory_permissions
FileUtils.mkdir_p(File.dirname(path), options) unless File.exist?(File.dirname(path))
FileUtils.mkdir_p(File.dirname(path), **options) unless File.exist?(File.dirname(path))
end

def chmod!(path, permissions)
Expand Down
4 changes: 2 additions & 2 deletions spec/downloader/base_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
let(:uploader) { uploader_class.new }
let(:file) { File.read(file_path("test.jpg")) }
let(:filename) { "test.jpg" }
let(:uri) { URI.encode("http://www.example.com/#{filename}") }
let(:uri) { "http://www.example.com/#{CGI.escape(filename)}" }

subject { CarrierWave::Downloader::Base.new(uploader) }

Expand All @@ -27,7 +27,7 @@
end

context "with a URL with internationalized domain name" do
let(:uri) { URI.encode("http://ドメイン名例.jp/#{filename}") }
let(:uri) { "http://ドメイン名例.jp/#{CGI.escape(filename)}" }
before do
stub_request(:get, 'http://xn--eckwd4c7cu47r2wf.jp/test.jpg').to_return(body: file)
end
Expand Down

0 comments on commit 9a37fc9

Please sign in to comment.