|
159 | 159 | # calling this more than once will load tasks again and 'invoke' or 'execute' calls |
160 | 160 | # will call rake tasks multiple times |
161 | 161 | Application.load_tasks |
162 | | - |
163 | | - # Set up Fog mock buckets once at suite start instead of every test |
164 | | - if Fog.mock? |
165 | | - CloudController::DependencyLocator.instance.droplet_blobstore.ensure_bucket_exists |
166 | | - CloudController::DependencyLocator.instance.package_blobstore.ensure_bucket_exists |
167 | | - CloudController::DependencyLocator.instance.global_app_bits_cache.ensure_bucket_exists |
168 | | - CloudController::DependencyLocator.instance.buildpack_blobstore.ensure_bucket_exists |
169 | | - end |
170 | 162 | end |
171 | 163 |
|
172 | 164 | rspec_config.before do |
|
177 | 169 | TestConfig.context = example.metadata[:job_context] || :api |
178 | 170 | TestConfig.reset |
179 | 171 |
|
180 | | - VCAP::CloudController::SecurityContext.clear |
181 | | - VCAP::Request.current_id = nil |
182 | | - allow_any_instance_of(VCAP::CloudController::UaaTokenDecoder).to receive(:uaa_issuer).and_return(UAAIssuer::ISSUER) |
183 | | - |
184 | | - mock_redis = MockRedis.new |
185 | | - allow(Redis).to receive(:new).and_return(mock_redis) |
186 | | - end |
187 | | - |
188 | | - # Only reset Fog mocks for tests that use blobstores (tagged with :fog_reset) |
189 | | - # This avoids the overhead of clearing and recreating buckets for every test |
190 | | - rspec_config.before(:each, :fog_reset) do |
191 | 172 | Fog::Mock.reset |
| 173 | + |
192 | 174 | if Fog.mock? |
193 | 175 | CloudController::DependencyLocator.instance.droplet_blobstore.ensure_bucket_exists |
194 | 176 | CloudController::DependencyLocator.instance.package_blobstore.ensure_bucket_exists |
195 | 177 | CloudController::DependencyLocator.instance.global_app_bits_cache.ensure_bucket_exists |
196 | 178 | CloudController::DependencyLocator.instance.buildpack_blobstore.ensure_bucket_exists |
197 | 179 | end |
| 180 | + |
| 181 | + VCAP::CloudController::SecurityContext.clear |
| 182 | + VCAP::Request.current_id = nil |
| 183 | + allow_any_instance_of(VCAP::CloudController::UaaTokenDecoder).to receive(:uaa_issuer).and_return(UAAIssuer::ISSUER) |
| 184 | + |
| 185 | + mock_redis = MockRedis.new |
| 186 | + allow(Redis).to receive(:new).and_return(mock_redis) |
198 | 187 | end |
199 | 188 |
|
200 | 189 | rspec_config.around do |example| |
|
0 commit comments