Sha256: 255f21c888c7c16d3d8f65488ed9a424c1be14fdc21c0b1353c50cc2f958f8ef

Contents?: true

Size: 1.33 KB

Versions: 4

Compression:

Stored size: 1.33 KB

Contents

# -*- encoding : utf-8 -*-

describe Card::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"
      Card::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 [Card[Card::WagnBotID].account.email], @mail.from
      end
    end
  end

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

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

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
wagn-1.13.0 spec/mailers/mailer_spec.rb
wagn-1.13.0.pre2 spec/mailers/mailer_spec.rb
wagn-1.13.0.pre1 spec/mailers/mailer_spec.rb
wagn-1.13.0.pre spec/mailers/mailer_spec.rb