Sha256: e6d5231aea47c5f230bc0e269da94da10ababf8326fe5d8b6aab41436123c8b4

Contents?: true

Size: 817 Bytes

Versions: 24

Compression:

Stored size: 817 Bytes

Contents

require 'spec_helper'

describe Comment do
  describe "when saved" do
    before :each do
      @comment = Comment.new
      @comment.stub(:valid?).and_return(true)
      @comment.stub(:approved?).and_return(true)
    end

    it "creates a comment subscriber" do
      @comment.subscribe = 1
      @comment.stub_chain(:commentable, :subscribers).and_return([])

      CommentSubscriber.should_receive(:create)
      @comment.save
    end

    it "notifies subscribers" do
      @comment.subscribe = 0
      subscriber = mock("subscriber", :email => "something@something.com")
      @comment.stub_chain(:commentable, :subscribers).and_return([subscriber])
      CommentMailer.stub_chain(:comment_notification, :deliver)

      CommentMailer.should_receive(:comment_notification)
      @comment.save
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
forge-cli-0.0.9 lib/forge/spec/models/comment_spec.rb
forge-cli-0.0.8 lib/forge/spec/models/comment_spec.rb
forge-cli-0.0.7 lib/forge/spec/models/comment_spec.rb
forge-cli-0.0.6 lib/forge/spec/models/comment_spec.rb