This repository has been archived by the owner on Apr 8, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtests.rb
47 lines (39 loc) · 1.65 KB
/
tests.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
require "rspec"
require "json"
require_relative "lib/metamailer.rb"
require_relative "config.rb" # this file contains all api keys etc. that are required in order to use the mailing APIs
$from = "MetaMailer <[email protected]>"
$to = "[email protected]"
$subject = "Test Message From MetaMailer"
$html = "<html><head></head><body><p>Hello from MetaMailer! If you are seeing this message, the test worked!</p></body></html>"
$text = "Hello from Metamailer! If you are seeing this message, the test worked!"
describe "Metamailer" do
before :all do
end
before :each do
end
it "sends through mailgun" do
mailgun = MetaMailer::Mailgun.new($mailgun_username, $mailgun_api_key)
response = mailgun.send($from, $to, $subject, $html, $text)
JSON.parse(response)["message"].include?("Queued. Thank you.").should eq true
end
it "sends through postageapp" do
#postageapp = MetaMailer::Postageapp.new($postageapp_api_key)
#response = postageapp.send($from, $to, $subject, $html, $text)
#response.should eq true
end
it "sends through elasticemail" do
elasticemail = MetaMailer::Elasticemail.new($elasticemail_username, $elasticemail_api_key)
response = elasticemail.send($from, $to, $subject, $html, $text)
response.body.size.should eq 36
end
it "sends through sendgrid" do
#sendgrid = MetaMailer::Sendgrid.new($sendgrid_api_user, $sendgrid_api_key)
#response = sendgrid.send($from, $to, $subject, $html, $text)
end
it "sends through jangomail" do
jangomail = MetaMailer::Jangomail.new($jangomail_username, $jangomail_password)
response = jangomail.send($from, $to, $subject, $html, $text)
response.body.to_s.include?("SUCCESS").should eq true
end
end