From b6d4c88d332c80992b880894feb4c4370e8f7b88 Mon Sep 17 00:00:00 2001 From: Hiroyuki Sato Date: Tue, 20 Dec 2016 00:45:51 +0900 Subject: Clean-up spec --- spec/models/repository_spec.rb | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/spec/models/repository_spec.rb b/spec/models/repository_spec.rb index 9c4ce13e223..5e38f8bec16 100644 --- a/spec/models/repository_spec.rb +++ b/spec/models/repository_spec.rb @@ -146,17 +146,11 @@ describe Repository, models: true do end describe '#cache_last_commit_id_for_path' do - subject { repository.cache_last_commit_id_for_path(sample_commit.id, '.gitignore') } - let(:cache) { repository.send(:cache) } - let(:key) { "last_commit_id_for_path:#{sample_commit.id}:#{Digest::SHA1.digest('.gitignore')}" } - before { cache.expire(key) } - after { cache.expire(key) } - it "caches #last_commit_id_for_path" do - expect(repository).to receive(:last_commit_id_for_path).once.and_return('c1acaa58bbcbc3eafe538cb8274ba387047b69f8') - 2.times do - is_expected.to eq('c1acaa58bbcbc3eafe538cb8274ba387047b69f8') - end + cache = repository.send(:cache) + key = "last_commit_id_for_path:#{sample_commit.id}:#{Digest::SHA1.hexdigest('.gitignore')}" + expect(cache).to receive(:fetch).with(key).and_return('c1acaa5') + expect(repository.cache_last_commit_id_for_path(sample_commit.id, '.gitignore')).to eq('c1acaa5') end end -- cgit v1.2.1