Sha256: 09ee5cb4c631532ee71405a03f5bd1a7ea4be8fe78347e67c0b865e44745bc50

Contents?: true

Size: 1.11 KB

Versions: 2

Compression:

Stored size: 1.11 KB

Contents

require 'spec/spec_helper'

describe MadMimi::Mailer do
  before (:all) do
    MadMimi.configure do |config|
      config.username = "email@example.com"
      config.api_key  = "api_key"
    end
  end

  describe ".mail" do
    before do
      stub_post('/mailer', true).
        with(:headers => {'Accept'=>'application/xml', 'Content-Type'=>'application/x-www-form-urlencoded', 'User-Agent'=>'MadMimi Gem'}).
        to_return(:status => 200, :body => "2875078090", :headers => {:content_type => "text/html; charset=utf-8"})
    end

    it "should remove audience list membership" do
      MadMimi.mailer.mail({ :promotion_name => "Welcome to Acme Widgets", :recipients => "Ozéias Sant'Ana <oz.santana@gmail.com>" })

      a_post('/mailer', true).
        with(:body => 'username=email%40example.com&promotion_name=Welcome+to+Acme+Widgets&recipients=Oz%C3%A9ias+Sant%27Ana+%3Coz.santana%40gmail.com%3E&api_key=api_key&check_suppressed=true').
        with(:headers => {'Accept'=>'application/xml', 'Content-Type'=>'application/x-www-form-urlencoded', 'User-Agent'=>'MadMimi Gem'}).
        should have_been_made
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mad_mimi-0.0.3 spec/mad_mimi/mailer_spec.rb
mad_mimi-0.0.2 spec/mad_mimi/mailer_spec.rb