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.1.10 lib/forge/spec/models/comment_spec.rb
forge-cli-0.1.9 lib/forge/spec/models/comment_spec.rb
forge-cli-0.1.8 lib/forge/spec/models/comment_spec.rb
forge-cli-0.1.7 lib/forge/spec/models/comment_spec.rb
forge-cli-0.1.6 lib/forge/spec/models/comment_spec.rb
forge-cli-0.1.5 lib/forge/spec/models/comment_spec.rb
forge-cli-0.1.4 lib/forge/spec/models/comment_spec.rb
forge-cli-0.1.3 lib/forge/spec/models/comment_spec.rb
forge-cli-0.1.2 lib/forge/spec/models/comment_spec.rb
forge-cli-0.1.1 lib/forge/spec/models/comment_spec.rb
forge-cli-0.1.0 lib/forge/spec/models/comment_spec.rb
forge-cli-0.0.18 lib/forge/spec/models/comment_spec.rb
forge-cli-0.0.17 lib/forge/spec/models/comment_spec.rb
forge-cli-0.0.16 lib/forge/spec/models/comment_spec.rb
forge-cli-0.0.15 lib/forge/spec/models/comment_spec.rb
forge-cli-0.0.14 lib/forge/spec/models/comment_spec.rb
forge-cli-0.0.13 lib/forge/spec/models/comment_spec.rb
forge-cli-0.0.12 lib/forge/spec/models/comment_spec.rb
forge-cli-0.0.11 lib/forge/spec/models/comment_spec.rb
forge-cli-0.0.10 lib/forge/spec/models/comment_spec.rb