spec/unit/mail_spec.rb in jpmobile-1.0.0.pre.5 vs spec/unit/mail_spec.rb in jpmobile-1.0.0.pre.6
- old
+ new
@@ -8,11 +8,11 @@
before(:each) do
@mail = Mail.new
@mail.subject = "万葉"
@mail.body = "ほげ"
- @mail.from = "info@jpmobile-rails.org"
+ @mail.from = "ちはやふる <info@jpmobile-rails.org>"
end
context "Mail#to" do
it "sets multi-tos" do
expect{@mail.to = ["a@hoge.com", "b@hoge.com"]}.to_not raise_error
@@ -21,29 +21,41 @@
describe "AbstractMobile" do
before(:each) do
@mobile = Jpmobile::Mobile::AbstractMobile.new(nil, nil)
@mail.mobile = @mobile
- @mail.to = "info+to@jpmobile-rails.org"
+ @mail.to = "むすめふさほせ <info+to@jpmobile-rails.org>"
end
context "to_s" do
it "should contain encoded subject" do
ascii_8bit(@mail.to_s).should match(Regexp.compile(Regexp.escape("=?ISO-2022-JP?B?GyRCS3xNVRsoQg==?=")))
end
it "should contain encoded body" do
ascii_8bit(@mail.to_s).should match(Regexp.compile(Regexp.escape(ascii_8bit("\x1b\x24\x42\x24\x5B\x24\x32\e\x28\x42"))))
end
+
+ it "should contain encoded from"do
+ ascii_8bit(@mail.to_s).should match(Regexp.compile(Regexp.escape(ascii_8bit("=?ISO-2022-JP?B?GyRCJEEkTyRkJFUkaxsoQg==?="))))
+ end
+
+ it "should contain encoded to" do
+ ascii_8bit(@mail.to_s).should match(Regexp.compile(Regexp.escape(ascii_8bit("=?ISO-2022-JP?B?GyRCJGAkOSRhJFUkNSRbJDsbKEI=?="))))
+ end
+
+ it "should contain correct Content-Type:" do
+ ascii_8bit(@mail.to_s).should match(Regexp.compile(Regexp.escape(ascii_8bit("charset=ISO-2022-JP"))))
+ end
end
end
describe "Docomo" do
before(:each) do
@mobile = Jpmobile::Mobile::Docomo.new(nil, nil)
@mail.mobile = @mobile
- @mail.to = "info+to@jpmobile-rails.org"
+ @mail.to = "むすめふさほせ <info+to@jpmobile-rails.org>"
end
context "to_s" do
it "should contain encoded subject" do
@mail.to_s.should match(sjis_regexp("=?Shift_JIS?B?lpyXdA==?="))
@@ -51,10 +63,18 @@
it "should contain encoded body" do
@mail.to_s.should match(Regexp.escape(utf8_to_sjis("ほげ")))
end
+ it "should contain encoded from" do
+ @mail.to_s.should match(sjis_regexp("gr+CzYLigtOC6Q=="))
+ end
+
+ it "should contain encoded to" do
+ @mail.to_s.should match(sjis_regexp("gt6Ct4LfgtOCs4LZgrk="))
+ end
+
it "should contains encoded emoticon" do
@mail.subject += ""
@mail.body = "#{@mail.body}"
@mail.to_s.should match(Regexp.escape("=?Shift_JIS?B?lpyXdPif?="))
@@ -65,11 +85,11 @@
describe "Au" do
before(:each) do
@mobile = Jpmobile::Mobile::Au.new(nil, nil)
@mail.mobile = @mobile
- @mail.to = "info+to@jpmobile-rails.org"
+ @mail.to = "むすめふさほせ <info+to@jpmobile-rails.org>"
end
context "to_s" do
it "should contain encoded subject" do
ascii_8bit(@mail.to_s).should match(Regexp.compile(Regexp.escape("=?ISO-2022-JP?B?GyRCS3xNVRsoQg==?=")))
@@ -77,10 +97,18 @@
it "should contain encoded body" do
ascii_8bit(@mail.to_s).should match(Regexp.compile(Regexp.escape(ascii_8bit("\x1b\x24\x42\x24\x5B\x24\x32\e\x28\x42"))))
end
+ it "should contain encoded from" do
+ ascii_8bit(@mail.to_s).should match(Regexp.compile(Regexp.escape(ascii_8bit("=?ISO-2022-JP?B?GyRCJEEkTyRkJFUkaxsoQg==?="))))
+ end
+
+ it "should contain encoded to" do
+ ascii_8bit(@mail.to_s).should match(Regexp.compile(Regexp.escape(ascii_8bit("=?ISO-2022-JP?B?GyRCJGAkOSRhJFUkNSRbJDsbKEI=?="))))
+ end
+
it "should contain encoded emoticon" do
@mail.subject += ""
@mail.body = "#{@mail.body}"
ascii_8bit(@mail.to_s).should match(Regexp.compile(Regexp.escape("=?ISO-2022-JP?B?GyRCS3xNVRsoQhskQnVBGyhC?=")))
@@ -91,11 +119,11 @@
describe "Softbank" do
before(:each) do
@mobile = Jpmobile::Mobile::Softbank.new(nil, nil)
@mail.mobile = @mobile
- @mail.to = "info+to@jpmobile-rails.org"
+ @mail.to = "むすめふさほせ <info+to@jpmobile-rails.org>"
end
context "to_s" do
it "should contain encoded subject" do
@mail.to_s.should match(Regexp.escape(sjis("=?Shift_JIS?B?lpyXdA==?=")))
@@ -103,10 +131,18 @@
it "should contain encoded body" do
@mail.to_s.should match(Regexp.escape(utf8_to_sjis("ほげ")))
end
+ it "should contain encoded from" do
+ @mail.to_s.should match(sjis_regexp("gr+CzYLigtOC6Q=="))
+ end
+
+ it "should contain encoded to" do
+ @mail.to_s.should match(sjis_regexp("gt6Ct4LfgtOCs4LZgrk="))
+ end
+
it "should contains encoded emoticon" do
@mail.subject += ""
@mail.body = "#{@mail.body}"
@mail.to_s.should match(Regexp.escape("=?Shift_JIS?B?lpyXdPmL?="))
@@ -125,11 +161,11 @@
describe "Docomo" do
before(:each) do
@mobile = Jpmobile::Mobile::Docomo.new(nil, nil)
@mail.mobile = @mobile
- @mail.to = "info+to@jpmobile-rails.org"
+ @mail.to = "むすめふさほせ <info+to@jpmobile-rails.org>"
end
it "should contain encoded subject" do
@mail.to_s.should match(sjis_regexp("=?Shift_JIS?B?lb6O0I3Ml3CJnpXlgtaCzIKokFyNnoLdkL2CyYKg?="))
@mail.to_s.should match(sjis_regexp("=?Shift_JIS?B?guiCqoLGgqSCsoK0gqKC3IK3gsaMvoKigr2CooLG?="))
@@ -142,11 +178,11 @@
describe "Au" do
before(:each) do
@mobile = Jpmobile::Mobile::Au.new(nil, nil)
@mail.mobile = @mobile
- @mail.to = "info+to@jpmobile-rails.org"
+ @mail.to = "むすめふさほせ <info+to@jpmobile-rails.org>"
end
it "should contain encoded subject" do
ascii_8bit(@mail.to_s).should match(Regexp.compile(Regexp.escape("=?ISO-2022-JP?B?GyRCSkA8UjpOTVExfkpnJFgkTiQqPz05fiRfQD8kSyQiGyhC?=")))
ascii_8bit(@mail.to_s).should match(Regexp.compile(Regexp.escape("=?ISO-2022-JP?B?GyRCJGokLCRIJCYkNCQ2JCQkXiQ5JEg4QCQkJD8kJCRIGyhC?=")))
@@ -159,11 +195,11 @@
describe "Softbank" do
before(:each) do
@mobile = Jpmobile::Mobile::Softbank.new(nil, nil)
@mail.mobile = @mobile
- @mail.to = "info+to@jpmobile-rails.org"
+ @mail.to = "むすめふさほせ <info+to@jpmobile-rails.org>"
end
it "should contain encoded subject" do
@mail.to_s.should match(sjis_regexp("=?Shift_JIS?B?lb6O0I3Ml3CJnpXlgtaCzIKokFyNnoLdkL2CyYKg?="))
@mail.to_s.should match(sjis_regexp("=?Shift_JIS?B?guiCqoLGgqSCsoK0gqKC3IK3gsaMvoKigr2CooLG?="))
@@ -176,10 +212,10 @@
describe "AbstractMobile" do
before(:each) do
@mobile = Jpmobile::Mobile::AbstractMobile.new(nil, nil)
@mail.mobile = @mobile
- @mail.to = "info+to@jpmobile-rails.org"
+ @mail.to = "むすめふさほせ <info+to@jpmobile-rails.org>"
end
context "to_s" do
it "should contain encoded subject" do
ascii_8bit(@mail.to_s).should match(Regexp.compile(Regexp.escape("=?ISO-2022-JP?B?GyRCSkA8UjpOTVExfkpnJFgkTiQqPz05fiRfQD8kSyQiGyhC?=")))