require 'spec_helper'

describe MergeRequests::MergeRequestDiffCacheService do
  let(:subject) { MergeRequests::MergeRequestDiffCacheService.new }

  describe '#execute' do
    it 'retrieves the diff files to cache the highlighted result' do
      merge_request = create(:merge_request)
      cache_key = [merge_request.merge_request_diff, 'highlighted-diff-files', Gitlab::Diff::FileCollection::MergeRequest.default_options]

      expect(Rails.cache).to receive(:read).with(cache_key).and_return({})
      expect(Rails.cache).to receive(:write).with(cache_key, anything)

      subject.execute(merge_request)
    end
  end
end

require 'spec_helper'

describe MergeRequests::MergeRequestDiffCacheService do
  let(:subject) { MergeRequests::MergeRequestDiffCacheService.new }

  describe '#execute' do
    it 'retrieves the diff files to cache the highlighted result' do
      merge_request = create(:merge_request)
      cache_key = [merge_request.merge_request_diff, 'highlighted-diff-files', Gitlab::Diff::FileCollection::MergeRequestDiff.default_options]

      expect(Rails.cache).to receive(:read).with(cache_key).and_return({})
      expect(Rails.cache).to receive(:write).with(cache_key, anything)

      subject.execute(merge_request)
    end
  end
end

Fix merge request diff cache service spec
Fix merge request diff cache service spec

Signed-off-by: Dmitriy Zaporozhets <be23d75b156792e5acab51b196a2deb155d35d6a@gmail.com>
