Commit 1da8bd8f authored by Hiroyuki Sato's avatar Hiroyuki Sato

Add specs.

parent 1f192757
...@@ -139,6 +139,27 @@ describe Repository, models: true do ...@@ -139,6 +139,27 @@ describe Repository, models: true do
it { is_expected.to eq('c1acaa58bbcbc3eafe538cb8274ba387047b69f8') } it { is_expected.to eq('c1acaa58bbcbc3eafe538cb8274ba387047b69f8') }
end end
describe '#last_commit_id_for_path' do
subject { repository.last_commit_id_for_path(sample_commit.id, '.gitignore') }
it { is_expected.to eq('c1acaa58bbcbc3eafe538cb8274ba387047b69f8') }
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
end
end
describe '#find_commits_by_message' do describe '#find_commits_by_message' do
it 'returns commits with messages containing a given string' do it 'returns commits with messages containing a given string' do
commit_ids = repository.find_commits_by_message('submodule').map(&:id) commit_ids = repository.find_commits_by_message('submodule').map(&:id)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment