Sha256: 6244e1bb03c23fbcf02a15bcf1028af6c2f74581a13fc418e69cd96aed483d9e

Contents?: true

Size: 721 Bytes

Versions: 5

Compression:

Stored size: 721 Bytes

Contents

require 'rails_helper'

RSpec.describe Comment, type: :model do

  let(:comment) { create(:comment) }

  it 'updates the original notification within the appropriate scope' do
    comment
    n = comment.notifications.first
    expect(notification_count).to eq(1)
    # This should update the notification.
    create(:comment, :user => comment.user, :post => comment.post)
    expect(notification_count).to eq(1)
    # This does not apply to the update -- a new notification is created.
    create(:comment, :post => comment.post)
    expect(notification_count).to eq(2)
    # Nor does this -- a new notification is created.
    create(:comment, :user => comment.user)
    expect(notification_count).to eq(3)
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
notify_on-1.0.5 spec/dummy/spec/models/comment_spec.rb
notify_on-1.0.4 spec/dummy/spec/models/comment_spec.rb
notify_on-1.0.3 spec/dummy/spec/models/comment_spec.rb
notify_on-1.0.2 spec/dummy/spec/models/comment_spec.rb
notify_on-1.0.1 spec/dummy/spec/models/comment_spec.rb