Sha256: 0d273894a4faef242783339d83f537321882d397d16aeda95f900c4f1484af5c

Contents?: true

Size: 1.12 KB

Versions: 11

Compression:

Stored size: 1.12 KB

Contents

# Copyright (c) 2008-2013 Michael Dvorkin and contributors.
#
# Fat Free CRM is freely distributable under the terms of MIT license.
# See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php
#------------------------------------------------------------------------------
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')

describe FatFreeCRM::CommentExtensions do
  describe "add_comment_by_user" do
    let(:user) { FactoryGirl.create(:user)}

    before :each do
      build_model(:commentable_entity) do
        string :subscribed_users
        serialize :subscribed_users, Set

        acts_as_commentable
        uses_comment_extensions
      end
    end

    it "should create a comment for user" do
      entity = CommentableEntity.create
      entity.add_comment_by_user("I will handle this one", user)
      entity.reload.comments.map(&:comment).should include("I will handle this one")
    end

    it "should not create a comment if body is blank" do
      entity = CommentableEntity.create
      entity.add_comment_by_user("", user)
      entity.reload.comments.should be_empty
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
fat_free_crm-0.13.6 spec/lib/comment_extensions_spec.rb
fat_free_crm-0.13.5 spec/lib/comment_extensions_spec.rb
fat_free_crm-0.13.4 spec/lib/comment_extensions_spec.rb
fat_free_crm-0.13.3 spec/lib/comment_extensions_spec.rb
fat_free_crm-0.13.2 spec/lib/comment_extensions_spec.rb
fat_free_crm-0.12.3 spec/lib/comment_extensions_spec.rb
fat_free_crm-0.12.2 spec/lib/comment_extensions_spec.rb
fat_free_crm-0.13.1 spec/lib/comment_extensions_spec.rb
fat_free_crm-0.12.1 spec/lib/comment_extensions_spec.rb
fat_free_crm-0.13.0 spec/lib/comment_extensions_spec.rb
fat_free_crm-0.12.0 spec/lib/comment_extensions_spec.rb