Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

silence warning #747

Merged
merged 1 commit into from

2 participants

@grosser

@bf4

spec/mail/network/delivery_methods/file_delivery_spec.rb:89: warning: File.exists? is a deprecated name, use File.exist? instead
spec/mail/network/delivery_methods/file_delivery_spec.rb:74: warning: File.exists? is a deprecated name, use File.exist? instead
spec/spec_helper.rb:33: warning: setting Encoding.default_external
@bf4 bf4 merged commit 1fbb948 into mikel:master

1 check failed

Details continuous-integration/travis-ci The Travis CI build could not complete due to an error
@grosser grosser deleted the zendesk:grosser/silence branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jul 22, 2014
  1. @grosser

    silence warning

    grosser authored
This page is out of date. Refresh to see the latest.
View
26 spec/mail/network/delivery_methods/file_delivery_spec.rb
@@ -15,14 +15,14 @@
:enable_starttls_auto => true }
end
end
-
+
after(:each) do
files = Dir.glob(File.join(Mail.delivery_method.settings[:location], '*'))
files.each do |file|
File.delete(file)
end
end
-
+
describe "general usage" do
tmpdir = File.expand_path('../../../../tmp/mail', __FILE__)
@@ -30,15 +30,15 @@
Mail.defaults do
delivery_method :file, :location => tmpdir
end
-
+
mail = Mail.deliver do
from 'roger@moore.com'
to 'marcel@amont.com'
subject 'invalid RFC2822'
end
-
+
delivery = File.join(Mail.delivery_method.settings[:location], 'marcel@amont.com')
-
+
expect(File.read(delivery)).to eq mail.encoded
end
@@ -46,16 +46,16 @@
Mail.defaults do
delivery_method :file, :location => tmpdir
end
-
+
mail = Mail.deliver do
from 'roger@moore.com'
to 'marcel@amont.com, bob@me.com'
subject 'invalid RFC2822'
end
-
+
delivery_one = File.join(Mail.delivery_method.settings[:location], 'marcel@amont.com')
delivery_two = File.join(Mail.delivery_method.settings[:location], 'bob@me.com')
-
+
expect(File.read(delivery_one)).to eq mail.encoded
expect(File.read(delivery_two)).to eq mail.encoded
end
@@ -64,21 +64,21 @@
Mail.defaults do
delivery_method :file, :location => tmpdir
end
-
+
Mail.deliver do
from 'roger@moore.com'
to '"Long, stupid email address" <mikel@test.lindsaar.net>'
subject 'invalid RFC2822'
end
delivery = File.join(Mail.delivery_method.settings[:location], 'mikel@test.lindsaar.net')
- expect(File.exists?(delivery)).to be_truthy
+ expect(File.exist?(delivery)).to be_truthy
end
it "should use the base name of the file name to prevent file system traversal" do
Mail.defaults do
delivery_method :file, :location => tmpdir
end
-
+
Mail.deliver do
from 'roger@moore.com'
to '../../../../../../../../../../../tmp/pwn'
@@ -86,7 +86,7 @@
end
delivery = File.join(Mail.delivery_method.settings[:location], 'pwn')
- expect(File.exists?(delivery)).to be_truthy
+ expect(File.exist?(delivery)).to be_truthy
end
it "should raise an error if no sender is defined" do
@@ -118,5 +118,5 @@
end
end
-
+
end
View
10 spec/spec_helper.rb
@@ -30,7 +30,15 @@
# NOTE: We set the KCODE manually here in 1.8.X because upgrading to rspec-2.8.0 caused it
# to default to "NONE" (Why!?).
$KCODE='UTF8' if RUBY_VERSION < '1.9'
-Encoding.default_external = 'utf-8' if defined?(Encoding) && Encoding.respond_to?(:default_external=)
+if defined?(Encoding) && Encoding.respond_to?(:default_external=)
+ begin
+ old, $VERBOSE = $VERBOSE, nil
+ Encoding.default_external = 'utf-8'
+ ensure
+ $VERBOSE = old
+ end
+end
+
def fixture(*name)
File.join(SPEC_ROOT, 'fixtures', name)
Something went wrong with that request. Please try again.