|
| 1 | +# Cloud Foundry Java Buildpack |
| 2 | +# Copyright 2013-2017 the original author or authors. |
| 3 | +# |
| 4 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | +# you may not use this file except in compliance with the License. |
| 6 | +# You may obtain a copy of the License at |
| 7 | +# |
| 8 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +# |
| 10 | +# Unless required by applicable law or agreed to in writing, software |
| 11 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | +# See the License for the specific language governing permissions and |
| 14 | +# limitations under the License. |
| 15 | + |
| 16 | +require 'spec_helper' |
| 17 | +require 'application_helper' |
| 18 | +require 'internet_availability_helper' |
| 19 | +require 'logging_helper' |
| 20 | +require 'java_buildpack/util/cache/application_cache' |
| 21 | +require 'java_buildpack/util/cache/cache_factory' |
| 22 | +require 'java_buildpack/util/cache/download_cache' |
| 23 | + |
| 24 | +describe JavaBuildpack::Util::Cache::CacheFactory do |
| 25 | + include_context 'application_helper' |
| 26 | + include_context 'internet_availability_helper' |
| 27 | + include_context 'logging_helper' |
| 28 | + |
| 29 | + previous_arg_value = ARGV[1] |
| 30 | + |
| 31 | + before do |
| 32 | + ARGV[1] = nil |
| 33 | + end |
| 34 | + |
| 35 | + after do |
| 36 | + ARGV[1] = previous_arg_value |
| 37 | + end |
| 38 | + |
| 39 | + it 'returns an ApplicationCache if ARGV[1] is defined' do |
| 40 | + ARGV[1] = app_dir |
| 41 | + |
| 42 | + expect(described_class.create).to be_instance_of JavaBuildpack::Util::Cache::ApplicationCache |
| 43 | + end |
| 44 | + |
| 45 | + it 'returns a DownloadCache if ARGV[1] is not defined' do |
| 46 | + expect(described_class.create).to be_instance_of JavaBuildpack::Util::Cache::DownloadCache |
| 47 | + end |
| 48 | + |
| 49 | +end |
0 commit comments