Commit b1228e70 authored by Olivier Halligon's avatar Olivier Halligon

[Command::Cache] Fixtures

parent c4f12885
...@@ -21,6 +21,7 @@ spec/fixtures/banana-lib ...@@ -21,6 +21,7 @@ spec/fixtures/banana-lib
spec/fixtures/chameleon spec/fixtures/chameleon
spec/fixtures/integration/Headers/ spec/fixtures/integration/Headers/
spec/fixtures/vcr spec/fixtures/vcr
spec/fixtures/cache/CocoaPods
# Examples # Examples
examples/**/Podfile.lock examples/**/Podfile.lock
......
...@@ -41,6 +41,7 @@ require 'claide' ...@@ -41,6 +41,7 @@ require 'claide'
require 'spec_helper/command' # Allows to run Pod commands and returns their output. require 'spec_helper/command' # Allows to run Pod commands and returns their output.
require 'spec_helper/fixture' # Provides access to the fixtures and unpacks them if needed. require 'spec_helper/fixture' # Provides access to the fixtures and unpacks them if needed.
require 'spec_helper/temporary_repos' # Allows to create and modify temporary spec repositories. require 'spec_helper/temporary_repos' # Allows to create and modify temporary spec repositories.
require 'spec_helper/temporary_cache' # Allows to create temporary cache directory.
require 'spec_helper/user_interface' # Redirects UI to UI.output & UI.warnings. require 'spec_helper/user_interface' # Redirects UI to UI.output & UI.warnings.
require 'spec_helper/pre_flight' # Cleans the temporary directory, the config & the UI.output before every test. require 'spec_helper/pre_flight' # Cleans the temporary directory, the config & the UI.output before every test.
......
require File.expand_path('../fixture', __FILE__)
module SpecHelper
module TemporaryCache
# Sets up a lighweight cache in `tmp/cocoapods/cache` with the
# contents of `spec/fixtures/cache/CocoaPods`.
#
def set_up_test_cache
require 'fileutils'
fixture_path = SpecHelper::Fixture.fixture('cache')
destination = SpecHelper.temporary_directory + 'cocoapods'
FileUtils.rm_rf(destination)
destination.mkpath
FileUtils.cp_r(fixture_path, destination)
# Add version file so that the cache isn't imploded on version mismatch
# (We don't include it in the tar.gz as we don't want to regenerate it each time)
version_file = tmp_cache_path + 'Pods/VERSION'
version_file.open('w') { |f| f << Pod::VERSION }
end
def tmp_cache_path
SpecHelper.temporary_directory + 'cocoapods/cache/CocoaPods'
end
module_function :set_up_test_cache, :tmp_cache_path
end
end
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