Sha256: cbe4814e3c5e890a57b504fc2c6783cedbb85a64178cdf5b80118287a3d632ef

Contents?: true

Size: 1.42 KB

Versions: 7

Compression:

Stored size: 1.42 KB

Contents

# -*- encoding : utf-8 -*-
require 'wagn/spec_helper'

describe Mailer do
  #include ActionMailer::Quoting

  before do
    ActionMailer::Base.delivery_method = :test
    ActionMailer::Base.perform_deliveries = true
    ActionMailer::Base.deliveries = []

    @expected = Mail.new
  end

  #
  ## see notifier test for data used in these tests
  # FIXME: the cache is not cleared properly between tests.  if the order changes
  #  (ie try renamed change notice below to change_notice) then *notify+*from gets stuck on.
  context "change notice" do
    before do
      user =  Card['sara'].id
      card =  Card["Sunglasses"]
      action = "edited"
      Mailer.change_notice( user, card, action, card.name ).deliver
    end

    it "deliver a message" do
      assert_equal 1, ActionMailer::Base.deliveries.size
    end

    context "change notice message" do
      before do
        @mail = ActionMailer::Base.deliveries[0]
      end
      it "is addressed to users email" do
        assert_equal ["sara@user.com"],  @mail.to
      end
      it "is from Wag bot email" do
        assert_equal [Account.admin.email], @mail.from
      end
    end
  end

  describe "flexmail" do
    # FIXME: at least two tests should be here, with & w/o attachment.
  end

  private
    def read_fixture(action)
      IO.readlines("#{FIXTURES_PATH}/user_notifier/#{action}")
    end

    def encode(subject)
      quoted_printable(subject, Mailer::CHARSET)
    end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
wagn-1.12.13 spec/mailers/mailer_spec.rb
wagn-1.12.12 spec/mailers/mailer_spec.rb
wagn-1.12.11 spec/mailers/mailer_spec.rb
wagn-1.12.10 spec/mailers/mailer_spec.rb
wagn-1.12.9 spec/mailers/mailer_spec.rb
wagn-1.12.8 spec/mailers/mailer_spec.rb
wagn-1.12.7 spec/mailers/mailer_spec.rb