Sha256: 4df877d48cee9a97b743b11cbada7f5b50f3f036ef05e891df1fa1e4f2434c4d

Contents?: true

Size: 916 Bytes

Versions: 6

Compression:

Stored size: 916 Bytes

Contents

require 'spec_helper'

module Commontator
  describe Subscription do
    before do
      setup_model_spec
      @subscription = Subscription.new
      @subscription.thread = @thread
      @subscription.subscriber = @user
      @subscription.save!
    end
    
    it 'must count unread comments' do
      @subscription.unread_comments.count.must_equal 0
      
      comment = Comment.new
      comment.thread = @thread
      comment.creator = @user
      comment.body = 'Something'
      comment.save!
      
      @subscription.reload.unread_comments.count.must_equal 1
      
      comment = Comment.new
      comment.thread = @thread
      comment.creator = @user
      comment.body = 'Something else'
      comment.save!
      
      @subscription.reload.unread_comments.count.must_equal 2
      
      @subscription.touch
      
      @subscription.reload.unread_comments.count.must_equal 0
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
commontator-4.8.0 spec/app/models/commontator/subscription_spec.rb
commontator-4.7.2 spec/app/models/commontator/subscription_spec.rb
commontator-4.7.1 spec/app/models/commontator/subscription_spec.rb
commontator-4.7.0 spec/app/models/commontator/subscription_spec.rb
commontator-4.6.1 spec/app/models/commontator/subscription_spec.rb
commontator-4.6.0 spec/app/models/commontator/subscription_spec.rb