Skip to content

Commit

Permalink
Merge pull request #140 from koic/suppress_deprecation_warnings
Browse files Browse the repository at this point in the history
Suppress deprecation warnings
  • Loading branch information
nashby committed Apr 13, 2017
2 parents 935978e + d29620f commit 9cb64c2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/letter_opener/delivery_method.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def deliver!(mail)

location = File.join(settings[:location], "#{Time.now.to_f.to_s.tr('.', '_')}_#{Digest::SHA1.hexdigest(mail.encoded)[0..6]}")
messages = Message.rendered_messages(location, mail)
Launchy.open("file:///#{URI.parse(URI.escape(messages.first.filepath))}")
Launchy.open("file:///#{URI.parse(CGI.escape(messages.first.filepath))}")
end
end
end
6 changes: 3 additions & 3 deletions lib/letter_opener/message.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ def render
filename = attachment_filename(attachment)
path = File.join(attachments_dir, filename)

unless File.exists?(path) # true if other parts have already been rendered
unless File.exist?(path) # true if other parts have already been rendered
File.open(path, 'wb') { |f| f.write(attachment.body.raw_source) }
end

@attachments << [attachment.filename, "attachments/#{URI.escape(filename)}"]
@attachments << [attachment.filename, "attachments/#{CGI.escape(filename)}"]
end
end

Expand Down Expand Up @@ -103,7 +103,7 @@ def encoding
end

def auto_link(text)
text.gsub(URI.regexp(%W[https http])) do |link|
text.gsub(URI::Parser.new.make_regexp(%W[https http])) do |link|
"<a href=\"#{ link }\">#{ link }</a>"
end
end
Expand Down
6 changes: 3 additions & 3 deletions spec/letter_opener/delivery_method_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@

it 'creates attachments dir with attachment' do
attachment = Dir["#{location}/*/attachments/#{File.basename(__FILE__)}"].first
expect(File.exists?(attachment)).to be_truthy
expect(File.exist?(attachment)).to be_truthy
end

it 'saves attachment name' do
Expand Down Expand Up @@ -251,7 +251,7 @@

it 'creates attachments dir with attachment' do
attachment = Dir["#{location}/*/attachments/#{File.basename(__FILE__)}"].first
expect(File.exists?(attachment)).to be_truthy
expect(File.exist?(attachment)).to be_truthy
end

it 'replaces inline attachment urls' do
Expand Down Expand Up @@ -283,7 +283,7 @@

it 'creates attachments dir with attachment' do
attachment = Dir["#{location}/*/attachments/non_word_chars_used_01-02.txt"].first
expect(File.exists?(attachment)).to be_truthy
expect(File.exist?(attachment)).to be_truthy
end

it 'saves attachment name' do
Expand Down

0 comments on commit 9cb64c2

Please sign in to comment.