diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2016-03-18 15:31:19 +0100 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2016-03-19 21:54:08 +0100 |
commit | 68a4c98f5074bd34f0178f2f967153c8d5c71237 (patch) | |
tree | 34ecc0cb78dfd4c80a181aece464689ae75b7dbb /spec/models/project_wiki_spec.rb | |
parent | 41b8d22631053e66043d05695d65f4961b91efd8 (diff) | |
download | gitlab-ce-68a4c98f5074bd34f0178f2f967153c8d5c71237.tar.gz |
Cache output of Repository#exists?
This caches the output of Repository#exists? in Redis while making sure
it's flushed properly when creating new repositories, deleting them,
etc.
For the ProjectWiki tests to work I had to make ProjectWiki#create_repo!
public as testing private methods in RSpec is a bit of a pain.
Diffstat (limited to 'spec/models/project_wiki_spec.rb')
-rw-r--r-- | spec/models/project_wiki_spec.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/spec/models/project_wiki_spec.rb b/spec/models/project_wiki_spec.rb index a2085df5bcd..532e3f013fd 100644 --- a/spec/models/project_wiki_spec.rb +++ b/spec/models/project_wiki_spec.rb @@ -244,6 +244,18 @@ describe ProjectWiki, models: true do end end + describe '#create_repo!' do + it 'creates a repository' do + expect(subject).to receive(:init_repo). + with(subject.path_with_namespace). + and_return(true) + + expect(subject.repository).to receive(:after_create) + + expect(subject.create_repo!).to be_an_instance_of(Gollum::Wiki) + end + end + private def create_temp_repo(path) |