Sha256: 657bb5ffee00b4db8160cd5ab0a26a9b055b67e066a3cdea66dc7ccb2f197714

Contents?: true

Size: 1.37 KB

Versions: 1

Compression:

Stored size: 1.37 KB

Contents

require 'spec_helper'

describe HttpMailer::Client do

  context "when configured" do
    let(:settings){ {:mailgun => {:host => "api.mailgun.net", :api_key => "key-12345", :subdomain => "sandbox12345.mailgun.org"},
                    :sendgrid => {:host => "sendgrid.com", :api_user=> "test", :api_key => "1234"},
                    :mandrill => {:host => "mandrillapp.com", :api_key => "1234567890"}} }

    describe "#initialize" do
      it "creates a client instance" do
        expect(HttpMailer::Client.new(settings)).to be_a HttpMailer::Client
      end
    end

    describe '#send_message' do
      let(:settings){ {:mailgun => {:host => "api.mailgun.net", :api_key => "key-12345", :subdomain => "sandbox12345.mailgun.org"},
                    :sendgrid => {:host => "sendgrid.com", :api_user=> "test", :api_key => "1234"},
                    :mandrill => {:host => "mandrillapp.com", :api_key => "1234567890"}} }
      let(:mailer_client){ HttpMailer::Client.new(settings) }

      let(:sender){ "sender@test.com"}
      let(:reciever){ "reciever@test.com>" }
      let(:subject){ "Hello" }
      let(:email_body){ "Congratulations, you just sent an email with HttpMailer!  You are truly awesome!" }

      it 'sends an email' do
        response = mailer_client.send_message(sender, reciever, subject, email_body)
        expect(response.code).to eq(200)
      end
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
http_mailer-0.0.5 spec/client_spec.rb