Sha256: 41cec43172568b71300d22459b1046f2f414c96588c7dc3c2f6a5271c4b95313

Contents?: true

Size: 1.13 KB

Versions: 15

Compression:

Stored size: 1.13 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)
      expect(entity.reload.comments.map(&:comment)).to 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)
      expect(entity.reload.comments).to be_empty
    end
  end
end

Version data entries

15 entries across 15 versions & 2 rubygems

Version Path
fat_free_crm-0.14.2 spec/lib/comment_extensions_spec.rb
fat_free_crm-0.15.2 spec/lib/comment_extensions_spec.rb
fat_free_crm-0.16.4 spec/lib/comment_extensions_spec.rb
fat_free_crm-0.14.1 spec/lib/comment_extensions_spec.rb
fat_free_crm-0.15.1 spec/lib/comment_extensions_spec.rb
fat_free_crm-0.16.3 spec/lib/comment_extensions_spec.rb
fat_free_crm-0.16.2 spec/lib/comment_extensions_spec.rb
fat_free_crm-0.16.1 spec/lib/comment_extensions_spec.rb
fat_free_crm-0.16.0 spec/lib/comment_extensions_spec.rb
fat_free_crm-0.15.0 spec/lib/comment_extensions_spec.rb
fat_free_crm-0.15.0.beta.2 spec/lib/comment_extensions_spec.rb
fat_free_crm-0.15.0.beta spec/lib/comment_extensions_spec.rb
fat_free_crm-0.14.0 spec/lib/comment_extensions_spec.rb
reduced_fat_crm-0.15.0.beta spec/lib/comment_extensions_spec.rb
reduced_fat_crm-0.14.0 spec/lib/comment_extensions_spec.rb