/
spec_helper.rb
59 lines (46 loc) · 1.21 KB
/
spec_helper.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
require 'rubygems'
require 'bacon'
require 'mocha-on-bacon'
require 'pathname'
ROOT = Pathname.new(File.expand_path('../../', __FILE__))
$:.unshift File.expand_path('../../external/Xcodeproj/ext', __FILE__)
$:.unshift File.expand_path('../../external/Xcodeproj/lib', __FILE__)
$:.unshift((ROOT + 'lib').to_s)
require 'cocoapods'
$:.unshift((ROOT + 'spec').to_s)
require 'spec_helper/fixture'
require 'spec_helper/git'
require 'spec_helper/temporary_directory'
context_class = defined?(BaconContext) ? BaconContext : Bacon::Context
context_class.class_eval do
include Pod::Config::Mixin
include SpecHelper::Fixture
def argv(*argv)
Pod::Command::ARGV.new(argv)
end
end
config = Pod::Config.instance
config.silent = true
config.repos_dir = SpecHelper.tmp_repos_path
class Pod::Source
def self.reset!
@sources = nil
end
end
class Pod::Spec::Set
def self.reset!
@sets = nil
end
end
require 'tmpdir'
def temporary_sandbox
Pod::Sandbox.new(Pathname.new(Dir.mktmpdir + "/Pods"))
end
def fixture_spec(name)
file = SpecHelper::Fixture.fixture(name)
Pod::Specification.from_file(file)
end
def copy_fixture_to_pod(name, pod)
path = SpecHelper::Fixture.fixture(name)
FileUtils.cp_r(path, pod.root)
end