test/test.rb in smtpapi-0.0.3 vs test/test.rb in smtpapi-0.0.4
- old
+ new
@@ -3,11 +3,11 @@
require "./lib/smtpapi"
class SmtpapiTest < Test::Unit::TestCase
def test_version
- assert_equal("0.0.3", Smtpapi::VERSION)
+ assert_equal("0.0.4", Smtpapi::VERSION)
end
def test_empty
header = Smtpapi::Header.new
assert_equal("{}",header.json_string)
@@ -102,8 +102,26 @@
def test_add_category_unicode
header = Smtpapi::Header.new
header.add_category('天破活殺') # category = ['天破活殺']
header.add_category('天翔十字鳳') # category = ['天破活殺', '天翔十字鳳']
assert_equal("{\"category\":[\"\\u5929\\u7834\\u6d3b\\u6bba\",\"\\u5929\\u7fd4\\u5341\\u5b57\\u9cf3\"]}",header.json_string)
+ end
+
+ def test_sent_send_all
+ header = Smtpapi::Header.new
+ localtime = Time.local(2014, 8, 29, 17, 56, 35)
+ header.set_send_all(localtime)
+
+ assert_equal("{\"send_all\":\"#{localtime.to_i}\"}", header.json_string)
+ end
+
+ def test_send_each_at
+ header = Smtpapi::Header.new
+ localtime1 = Time.local(2014, 8, 29, 17, 56, 35)
+ localtime2 = Time.local(2013, 12, 31, 0, 0, 0)
+ localtime3 = Time.local(2015, 9, 1, 4, 5, 6)
+ header.set_send_each_at([localtime1, localtime2, localtime3])
+
+ assert_equal("{\"send_each_at\":[\"#{localtime1.to_i}\",\"#{localtime2.to_i}\",\"#{localtime3.to_i}\"]}", header.json_string)
end
end