Sha256: 6f23759eec88b9f30c1fd7585c9c87a0082caf3327a02f40bddd0817d127fcab

Contents?: true

Size: 810 Bytes

Versions: 2

Compression:

Stored size: 810 Bytes

Contents

# frozen_string_literal: true

require 'rails_helper'

RSpec.describe Voting::Extension, 'after_save' do
  context 'when record is author' do
    let!(:record) { build :author }

    it 'does warm up the cache' do
      expect(record).not_to receive(:voting_warm_up)

      record.save
    end
  end

  context 'when record is not author' do
    context 'when record has scoping' do
      let!(:record) { build :article }

      it 'warms up the cache' do
        expect(record).to receive(:voting_warm_up).with(scoping: :categories)

        record.save
      end
    end

    context 'when record has no scoping' do
      let!(:record) { build :comment }

      it 'warms up the cache' do
        expect(record).to receive(:voting_warm_up).with(scoping: nil)

        record.save
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
voting-0.2.0 spec/models/extension/after_save_spec.rb
voting-0.1.0 spec/models/extension/after_save_spec.rb