diff options
author | Robert Speicher <rspeicher@gmail.com> | 2017-08-21 17:09:37 -0400 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2017-08-22 13:06:25 -0400 |
commit | a6fbd8648e782d871482cad5719a4fdd9fa5a6bc (patch) | |
tree | 6217eda7bbd22e77288330c788dbbfe2062eabbc /spec/spec_helper.rb | |
parent | 8654b771588fff719aa313cd115b0c6fa4ab36f3 (diff) | |
download | gitlab-ce-a6fbd8648e782d871482cad5719a4fdd9fa5a6bc.tar.gz |
Stub `ForkedStorageCheck.storage_available?` by default in all specsrs-stub-storage-availability-check
Add `:broken_storage` metadata to examples to disable this behavior only
when necessary.
Diffstat (limited to 'spec/spec_helper.rb')
-rw-r--r-- | spec/spec_helper.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index c10197ff651..ff1754fbe7e 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -105,6 +105,18 @@ RSpec.configure do |config| reset_delivered_emails! end + # Stub the `ForkedStorageCheck.storage_available?` method unless + # `:broken_storage` metadata is defined + # + # This check can be slow and is unnecessary in a test environment where we + # know the storage is available, because we create it at runtime + config.before(:example) do |example| + unless example.metadata[:broken_storage] + allow(Gitlab::Git::Storage::ForkedStorageCheck) + .to receive(:storage_available?).and_return(true) + end + end + config.around(:each, :use_clean_rails_memory_store_caching) do |example| caching_store = Rails.cache Rails.cache = ActiveSupport::Cache::MemoryStore.new |