Commit 99d2ecf6 authored by Marius Rackwitz's avatar Marius Rackwitz

[SpecHelper::TemporaryRepos] Fix issue with bacon

Methods are not properly inherited from contexts while setup and teardown callbacks are inherited. Fix that by calling #temorary_repos_path on the module.
parent c9092041
......@@ -44,8 +44,6 @@ module Pod
end
describe 'with a git based spec repository with a remote' do
extend SpecHelper::TemporaryRepos
before do
config.repos_dir = tmp_repos_path
......
......@@ -194,8 +194,6 @@ module Pod
#-------------------------------------------------------------------------#
describe 'lint subcommand' do
extend SpecHelper::TemporaryRepos
it "complains if it can't find any spec to lint" do
Dir.chdir(temporary_directory) do
lambda { command('spec', 'lint').run }.should.raise Informative
......
......@@ -38,8 +38,6 @@ module Pod
end
describe 'tells the user that the Pods cannot be updated unless they are installed' do
extend SpecHelper::TemporaryRepos
before do
podfile = Podfile.new do
platform :ios
......
......@@ -76,12 +76,26 @@ module SpecHelper
#--------------------------------------#
def tmp_repos_path
SpecHelper.temporary_directory + 'cocoapods/repos'
TemporaryRepos.tmp_repos_path
end
module_function :tmp_repos_path
def self.tmp_repos_path
SpecHelper.temporary_directory + 'cocoapods/repos'
end
def self.extended(base)
# Make Context methods available
# WORKAROUND: Bacon auto-inherits singleton methods to child contexts
# by using the runtime and won't include methods in modules included
# by the parent context. We have to ensure that the methods will be
# accessible by the child contexts by defining them as singleton methods.
TemporaryRepos.instance_methods.each do |method|
unbound_method = base.method(method).unbind
base.define_singleton_method method do |*args, &b|
unbound_method.bind(self).call(*args, &b)
end
end
base.before do
tmp_repos_path.mkpath
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