Skip to content
This repository has been archived by the owner on Jul 13, 2023. It is now read-only.

Commit

Permalink
Fix style comments
Browse files Browse the repository at this point in the history
  • Loading branch information
netmask committed May 11, 2016
1 parent a890f98 commit fe1197d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
4 changes: 2 additions & 2 deletions lib/paperclip/io_adapters/uri_adapter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ def cache_current_values
end

def extract_attachment_filename
if @content.meta.has_key? 'content-disposition'
@original_filename = @content.meta['content-disposition']
if @content.meta.has_key? "content-disposition"
@original_filename = @content.meta["content-disposition"]
.match(/filename="([^"]*)"/)[1]
end
end
Expand Down
4 changes: 2 additions & 2 deletions spec/paperclip/io_adapters/http_url_proxy_adapter_spec.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
require 'spec_helper'

describe Paperclip::HttpUrlProxyAdapter do

before do
@open_return = StringIO.new("xxx")
@open_return.stubs(:content_type).returns("image/png")
@open_return.stubs(:meta).returns({})
Paperclip::HttpUrlProxyAdapter.any_instance.stubs(:download_content).returns(@open_return)
Paperclip::HttpUrlProxyAdapter.any_instance.
stubs(:download_content).returns(@open_return)
end

context "a new instance" do
Expand Down
13 changes: 9 additions & 4 deletions spec/paperclip/io_adapters/uri_adapter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@

describe Paperclip::UriAdapter do
let(:content_type) { "image/png" }
let(:meta) { { } }
let(:meta) { {} }

before do
@open_return = StringIO.new("xxx")
@open_return.stubs(:content_type).returns(content_type)
@open_return.stubs(:meta).returns(meta)
Paperclip::UriAdapter.any_instance.stubs(:download_content).returns(@open_return)
Paperclip::UriAdapter.any_instance.
stubs(:download_content).returns(@open_return)
end

context "a new instance" do
Expand Down Expand Up @@ -91,8 +92,12 @@
end

context "a url with content disposition headers" do
let(:file_name) { 'test_document.pdf' }
let(:meta) { { 'content-disposition' => "attachment; filename=\"#{file_name}\";" } }
let(:file_name) { "test_document.pdf" }
let(:meta) do
{
"content-disposition" => "attachment; filename=\"#{file_name}\";",
}
end

before do
@uri = URI.parse("https://github.com/thoughtbot/paperclip?file=test")
Expand Down

0 comments on commit fe1197d

Please sign in to comment.