Sha256: dcd665c852ed528f06d1c193392e4f58ac94729435ccb9f8d905f8dfd13a2357

Contents?: true

Size: 1.81 KB

Versions: 7

Compression:

Stored size: 1.81 KB

Contents

require "spec_helper"

module ShortMessage
  describe Mailer do
    describe "reload notification" do
      ShortMessage.configure do |config|
        config.reload_notification_email = "webmaster@your-domain.com"
        config.default_mail_sender = "webmaster@your-domain.com"
      end
      
      amount = 20
      
      let(:mail) { ShortMessage::Mailer.recharge_notification amount }
      
      it "renders the subject" do
        mail.subject.should == "SMS credit recharged"
      end
      
      it "renders the sender email" do
        mail.from.should == ["webmaster@your-domain.com"]
      end
      
      it "renders the recipient email" do
        mail.to.should == ["webmaster@your-domain.com"]
      end
      
      it "contains the amount in the body" do
        mail.body.encoded.should match(amount.to_s)
      end
    end
    
    describe "voucher notification" do
      ShortMessage.configure do |config|
        config.user_id = "123456789abcdefghijklmnopq"
        config.voucher_notification_email = "give-me-money@your-domain.com"
        config.default_mail_sender = "webmaster@your-domain.com"
      end
      
      amount = 20
      
      let(:mail) { ShortMessage::Mailer.voucher_notification amount }
      
      it "renders the subject" do
        mail.subject.should == "SMS credit recharged, please create a voucher"
      end
      
      it "renders the sender email" do
        mail.from.should == ["webmaster@your-domain.com"]
      end
      
      it "renders the recipient email" do
        mail.to.should == ["give-me-money@your-domain.com"]
      end
      
      it "contains the amount in the body" do
        mail.body.encoded.should match(amount.to_s)
      end
      
      it "contains the customer in the body" do
        mail.body.encoded.should match(amount.to_s)
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
short_message-0.1.0 spec/mailers/short_message/mailer_spec.rb
short_message-0.0.6 spec/mailers/short_message/mailer_spec.rb
short_message-0.0.5 spec/mailers/short_message/mailer_spec.rb
short_message-0.0.4 spec/mailers/short_message/mailer_spec.rb
short_message-0.0.3 spec/mailers/short_message/mailer_spec.rb
short_message-0.0.2 spec/mailers/short_message/mailer_spec.rb
short_message-0.0.1 spec/mailers/short_message/mailer_spec.rb