Skip to content

Loading…

Fix missing .should calls in tests. #643

Open
wants to merge 1 commit into from

1 participant

@bk2204

Several of the message tests were missing their .should invocations, resulting in those tests not testing what they should (no pun intended). Modify these tests to use the proper syntax, fix the regular expressions to match appropriately, and mark the two failing tests as pending.

I adjusted the regular expressions after testing sample fixups for each of the two tests I marked pending. The charset=US-ASCII test fails because the output actually has charset=UTF-8, and the attachment test fails because a charset is generated for attachments. I left them pending because it wasn't clear to me what the correct behavior should be.

@bk2204 bk2204 Fix missing .should calls in tests.
Several of the message tests were missing their .should invocations, resulting
in those tests not testing what they should.  Modify these tests to use the
proper syntax, fix the regular expressions to match appropriately, and mark the
two failing tests as pending.
c5c6bff
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 9, 2013
  1. @bk2204

    Fix missing .should calls in tests.

    bk2204 committed
    Several of the message tests were missing their .should invocations, resulting
    in those tests not testing what they should.  Modify these tests to use the
    proper syntax, fix the regular expressions to match appropriately, and mark the
    two failing tests as pending.
Showing with 6 additions and 4 deletions.
  1. +6 −4 spec/mail/message_spec.rb
View
10 spec/mail/message_spec.rb
@@ -1117,18 +1117,20 @@ def basic_email
end
it "should set the content type to text/plain; charset=us-ascii" do
+ pending
body = "This is plain text US-ASCII"
mail = Mail.new
mail.body = body
- mail.to_s =~ %r{Content-Type: text/plain; charset=US-ASCII}
+ mail.to_s.should =~ %r{Content-Type: text/plain;\s+charset=US-ASCII}
end
it "should not set the charset if the file is an attachment" do
+ pending
body = "This is plain text US-ASCII"
mail = Mail.new
mail.body = body
mail.content_disposition = 'attachment; filename="foo.jpg"'
- mail.to_s =~ %r{Content-Type: text/plain;\r\n}
+ mail.to_s.should =~ %r{Content-Type: text/plain\r\n}
end
it "should raise a warning if there is no content type and there is non ascii chars and default to text/plain, UTF-8" do
@@ -1137,7 +1139,7 @@ def basic_email
mail.body = body
mail.content_transfer_encoding = "8bit"
STDERR.should_receive(:puts).with(/Non US-ASCII detected and no charset defined.\nDefaulting to UTF-8, set your own if this is incorrect./m)
- mail.to_s =~ %r{Content-Type: text/plain; charset=UTF-8}
+ mail.to_s.should =~ %r{Content-Type: text/plain;\s+charset=UTF-8}
end
it "should raise a warning if there is no charset parameter and there is non ascii chars and default to text/plain, UTF-8" do
@@ -1147,7 +1149,7 @@ def basic_email
mail.content_type = "text/plain"
mail.content_transfer_encoding = "8bit"
STDERR.should_receive(:puts).with(/Non US-ASCII detected and no charset defined.\nDefaulting to UTF-8, set your own if this is incorrect./m)
- mail.to_s =~ %r{Content-Type: text/plain; charset=UTF-8}
+ mail.to_s.should =~ %r{Content-Type: text/plain;\s+charset=UTF-8}
end
it "should not raise a warning if there is a charset defined and there is non ascii chars" do
Something went wrong with that request. Please try again.