Sha256: 4a2ca2dbc689f74004c1f7dbe2ad048dfc11f3597ca287235cbf9b6e77415e75

Contents?: true

Size: 1.03 KB

Versions: 4

Compression:

Stored size: 1.03 KB

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.size.must_equal 1
      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