Sha256: 978e242e0fe30825981bb8b1b1845f58859fea6f385b6b61bc5fd747a4af2833

Contents?: true

Size: 715 Bytes

Versions: 2

Compression:

Stored size: 715 Bytes

Contents

require 'spec_helper'

module Commontator
  describe CommentObserver do
    before do
      setup_model_spec
      @comment_observer = CommentObserver.send :new
      @thread.subscribe(@user)
      @comment = Comment.new
      @comment.thread = @thread
      @comment.creator = @user
      @comment.body = 'Something'
      @comment.save!
    end
    
    it 'wont send mail unless recipients not empty' do
      @comment_observer.after_create(@comment).must_be_nil
    end
    
    it 'must send mail if recipients not empty' do
      @user2 = DummyUser.create
      @thread.subscribe(@user2)
      @comment.reload
      @comment_observer.after_create(@comment).must_be_instance_of Mail::Message
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
commontator-1.1.1 spec/app/models/commontator/comment_observer_spec.rb~
commontator-1.1.0 spec/app/models/commontator/comment_observer_spec.rb