Sha256: da1b99c45a4889ca37bd086d2ace78d0a33f8401b76a2103a3a688b050e00320

Contents?: true

Size: 485 Bytes

Versions: 5

Compression:

Stored size: 485 Bytes

Contents

require 'rails_helper'

RSpec.describe User, :type => :model do

  let(:user) { create(:user) }

  describe 'self#receives_notifications' do
    it 'should be associated to notifications' do
      expect(user.respond_to?(:notifications)).to eq(true)
    end
  end

  it 'deletes its notifications when it is deleted' do
    user
    create(:message, :user => user)
    expect(user.notifications.count).to eq(1)
    user.destroy
    expect(user.notifications.count).to eq(0)
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

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