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 ...@@ -44,8 +44,6 @@ module Pod
end end
describe 'with a git based spec repository with a remote' do describe 'with a git based spec repository with a remote' do
extend SpecHelper::TemporaryRepos
before do before do
config.repos_dir = tmp_repos_path config.repos_dir = tmp_repos_path
......
...@@ -194,8 +194,6 @@ module Pod ...@@ -194,8 +194,6 @@ module Pod
#-------------------------------------------------------------------------# #-------------------------------------------------------------------------#
describe 'lint subcommand' do describe 'lint subcommand' do
extend SpecHelper::TemporaryRepos
it "complains if it can't find any spec to lint" do it "complains if it can't find any spec to lint" do
Dir.chdir(temporary_directory) do Dir.chdir(temporary_directory) do
lambda { command('spec', 'lint').run }.should.raise Informative lambda { command('spec', 'lint').run }.should.raise Informative
......
...@@ -38,8 +38,6 @@ module Pod ...@@ -38,8 +38,6 @@ module Pod
end end
describe 'tells the user that the Pods cannot be updated unless they are installed' do describe 'tells the user that the Pods cannot be updated unless they are installed' do
extend SpecHelper::TemporaryRepos
before do before do
podfile = Podfile.new do podfile = Podfile.new do
platform :ios platform :ios
......
...@@ -76,12 +76,26 @@ module SpecHelper ...@@ -76,12 +76,26 @@ module SpecHelper
#--------------------------------------# #--------------------------------------#
def tmp_repos_path def tmp_repos_path
SpecHelper.temporary_directory + 'cocoapods/repos' TemporaryRepos.tmp_repos_path
end end
module_function :tmp_repos_path def self.tmp_repos_path
SpecHelper.temporary_directory + 'cocoapods/repos'
end
def self.extended(base) 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 base.before do
tmp_repos_path.mkpath tmp_repos_path.mkpath
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