Sha256: 646497fb3b3db552105aefb298982f6ecf2a2266d788fd33e48597a3eb55e0ac

Contents?: true

Size: 1020 Bytes

Versions: 4

Compression:

Stored size: 1020 Bytes

Contents

require 'spec_helper'

module Commontator
  describe SubscriptionsMailer do
    before do
      setup_mailer_spec
      @comment = Comment.new
      @comment.thread = @thread
      @comment.creator = @user
      @comment.body = 'Something'
      @comment.save!
      @commontable_url = 'dummy_model_url'
      @thread.subscribe(@user)
    end
    
    it 'wont send email if subscribers empty' do
      mail = SubscriptionsMailer.comment_created_email(@comment, @commontable_url)
      mail.to.must_be_nil
      mail.cc.must_be_nil
      mail.bcc.must_be_nil
      mail.subject.must_be_nil
      mail.body.must_be_empty
    end
    
    it 'must send email if subscribers not empty' do
      user2 = DummyUser.create
      @thread.subscribe(DummyUser.create)
      mail = SubscriptionsMailer.comment_created_email(@comment, @commontable_url)
      mail.to.must_be_nil
      mail.cc.must_be_nil
      mail.bcc.must_include user2.email
      mail.subject.wont_be_empty
      mail.body.wont_be_empty
    end
    
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
commontator-1.0.6 spec/app/mailers/commontator/subscriptions_mailer_spec.rb~
commontator-1.0.5 spec/app/mailers/commontator/subscriptions_mailer_spec.rb~
commontator-1.0.4 spec/app/mailers/commontator/subscriptions_mailer_spec.rb~
commontator-1.0.3 spec/app/mailers/commontator/subscriptions_mailer_spec.rb~