diff options
author | Paco Guzman <pacoguzmanp@gmail.com> | 2016-07-26 10:21:42 +0300 |
---|---|---|
committer | Paco Guzman <pacoguzmanp@gmail.com> | 2016-08-03 08:00:20 +0300 |
commit | 8f359ea9170b984ad43d126e17628c31ac3a1f14 (patch) | |
tree | ee47d5172537ddedabc2cc38ef3cb5bf966c89ee /spec/services | |
parent | cd7c2cb6ddd4d9c9f9bdae00c887c0022c121c17 (diff) |
Move to Gitlab::Diff::FileCollection
Instead calling diff_collection.count use diff_collection.size which is cache on the diff_collection
Diffstat (limited to 'spec/services')
-rw-r--r-- | spec/services/merge_requests/merge_request_diff_cache_service_spec.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/services/merge_requests/merge_request_diff_cache_service_spec.rb b/spec/services/merge_requests/merge_request_diff_cache_service_spec.rb new file mode 100644 index 00000000000..c6cceed31ad --- /dev/null +++ b/spec/services/merge_requests/merge_request_diff_cache_service_spec.rb @@ -0,0 +1,18 @@ +require 'spec_helper' + +describe MergeRequests::MergeRequestDiffCacheService do + + let(:subject) { MergeRequests::MergeRequestDiffCacheService.new } + + describe '#execute' do + it 'retrieve 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.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 |