Commit da1fcacc authored by Eloy Duran's avatar Eloy Duran

Make the specs run with the addition of a new Reachability version.

parent b842655c
Subproject commit a0a6f17c205e76074384af2dbcc18796eff40ce0 Subproject commit 49cb88232dc6547bfc9751521a38889ec9f9f803
...@@ -78,8 +78,8 @@ describe "Pod::Command" do ...@@ -78,8 +78,8 @@ describe "Pod::Command" do
it "searches for a pod with name, summary, or description matching the given query ignoring case" do it "searches for a pod with name, summary, or description matching the given query ignoring case" do
[ [
['systemCONfiguration', %w{ Reachablity }], ['systemCONfiguration', %w{ Reachability }],
['is', %w{ ASIHTTPRequest Reachablity SSZipArchive }], ['is', %w{ ASIHTTPRequest Reachability SSZipArchive }],
].each do |query, results| ].each do |query, results|
command = Pod::Command.parse('search', '--silent', '--full', query) command = Pod::Command.parse('search', '--silent', '--full', query)
def command.puts(msg = '') def command.puts(msg = '')
......
...@@ -156,6 +156,7 @@ else ...@@ -156,6 +156,7 @@ else
config.rootspec = self config.rootspec = self
self.platform platform self.platform platform
dependency 'Reachability', '< 2.0.5' if platform == :ios
dependency 'ASIWebPageRequest', '>= 1.8.1' dependency 'ASIWebPageRequest', '>= 1.8.1'
dependency 'JSONKit', '>= 1.0' dependency 'JSONKit', '>= 1.0'
dependency 'SSZipArchive', '< 2' dependency 'SSZipArchive', '< 2'
...@@ -175,11 +176,13 @@ else ...@@ -175,11 +176,13 @@ else
'DEPENDENCIES' => [ 'DEPENDENCIES' => [
"ASIWebPageRequest (>= 1.8.1)", "ASIWebPageRequest (>= 1.8.1)",
"JSONKit (>= 1.0)", "JSONKit (>= 1.0)",
"Reachability (< 2.0.5)",
"SSZipArchive (< 2)", "SSZipArchive (< 2)",
] ]
} }
unless platform == :ios unless platform == :ios
# No Reachability is required by ASIHTTPRequest on OSX # No Reachability is required by ASIHTTPRequest on OSX
lock_file_contents['DEPENDENCIES'].delete_at(2)
lock_file_contents['PODS'].delete_at(3) lock_file_contents['PODS'].delete_at(3)
lock_file_contents['PODS'][0] = 'ASIHTTPRequest (1.8.1)' lock_file_contents['PODS'][0] = 'ASIHTTPRequest (1.8.1)'
end end
...@@ -196,23 +199,25 @@ else ...@@ -196,23 +199,25 @@ else
end end
end end
it "does not activate pods that are only part of other pods" do if platform == :ios
spec = Pod::Podfile.new do it "does not activate pods that are only part of other pods" do
# first ensure that the correct info is available to the specs when they load spec = Pod::Podfile.new do
config.rootspec = self # first ensure that the correct info is available to the specs when they load
config.rootspec = self
self.platform platform self.platform platform
dependency 'Reachability' dependency 'Reachability', '2.0.4' # only 2.0.4 is part of ASIHTTPRequest’s source.
end end
installer = SpecHelper::Installer.new(spec) installer = SpecHelper::Installer.new(spec)
installer.install! installer.install!
YAML.load(installer.lock_file.read).should == { YAML.load(installer.lock_file.read).should == {
'PODS' => [{ 'Reachability (2.0.4)' => ["ASIHTTPRequest (>= 1.8)"] }], 'PODS' => [{ 'Reachability (2.0.4)' => ["ASIHTTPRequest (>= 1.8)"] }],
'DOWNLOAD_ONLY' => ["ASIHTTPRequest (1.8.1)"], 'DOWNLOAD_ONLY' => ["ASIHTTPRequest (1.8.1)"],
'DEPENDENCIES' => ["Reachability"] 'DEPENDENCIES' => ["Reachability (= 2.0.4)"]
} }
end
end end
it "adds resources to the xcode copy script" do it "adds resources to the xcode copy script" do
......
...@@ -25,8 +25,6 @@ describe "Pod::Installer" do ...@@ -25,8 +25,6 @@ describe "Pod::Installer" do
config.silent = true config.silent = true
config.repos_dir = fixture('spec-repos') config.repos_dir = fixture('spec-repos')
config.project_pods_root = fixture('integration') config.project_pods_root = fixture('integration')
def config.ios?; true; end
def config.osx?; false; end
end end
after do after do
...@@ -34,12 +32,13 @@ describe "Pod::Installer" do ...@@ -34,12 +32,13 @@ describe "Pod::Installer" do
end end
it "generates a BridgeSupport metadata file from all the pod headers" do it "generates a BridgeSupport metadata file from all the pod headers" do
spec = Pod::Podfile.new do podfile = Pod::Podfile.new do
platform :osx platform :osx
dependency 'ASIHTTPRequest' dependency 'ASIHTTPRequest'
end end
config.rootspec = podfile
expected = [] expected = []
installer = Pod::Installer.new(spec) installer = Pod::Installer.new(podfile)
installer.build_specifications.each do |spec| installer.build_specifications.each do |spec|
spec.header_files.each do |header| spec.header_files.each do |header|
expected << config.project_pods_root + header expected << config.project_pods_root + header
...@@ -55,6 +54,7 @@ describe "Pod::Installer" do ...@@ -55,6 +54,7 @@ describe "Pod::Installer" do
dependency 'JSONKit' dependency 'JSONKit'
end end
end end
config.rootspec = podfile
installer = Pod::Installer.new(podfile) installer = Pod::Installer.new(podfile)
installer.target_installers.map(&:definition).map(&:name).should == [:not_empty] installer.target_installers.map(&:definition).map(&:name).should == [:not_empty]
end end
...@@ -64,6 +64,7 @@ describe "Pod::Installer" do ...@@ -64,6 +64,7 @@ describe "Pod::Installer" do
platform :osx platform :osx
dependency 'ASIHTTPRequest' dependency 'ASIHTTPRequest'
end end
config.rootspec = podfile
installer = Pod::Installer.new(podfile) installer = Pod::Installer.new(podfile)
installer.target_installers.first.install! installer.target_installers.first.install!
phases = installer.project.targets.first.buildPhases phases = installer.project.targets.first.buildPhases
......
...@@ -22,12 +22,16 @@ end ...@@ -22,12 +22,16 @@ end
describe "Pod::Resolver" do describe "Pod::Resolver" do
before do before do
Pod::Spec::Set.reset!
@config_before = config @config_before = config
Pod::Config.instance = nil Pod::Config.instance = nil
config.silent = true config.silent = true
config.repos_dir = fixture('spec-repos') config.repos_dir = fixture('spec-repos')
def config.ios?; true; end @podfile = Pod::Podfile.new do
def config.osx?; false; end platform :ios
dependency 'ASIWebPageRequest'
end
config.rootspec = @podfile
end end
after do after do
...@@ -39,31 +43,29 @@ describe "Pod::Resolver" do ...@@ -39,31 +43,29 @@ describe "Pod::Resolver" do
sets << Pod::Spec::Set.by_pod_dir(fixture('spec-repos/master/Reachability')) sets << Pod::Spec::Set.by_pod_dir(fixture('spec-repos/master/Reachability'))
sets << Pod::Spec::Set.by_pod_dir(fixture('spec-repos/master/ASIHTTPRequest')) sets << Pod::Spec::Set.by_pod_dir(fixture('spec-repos/master/ASIHTTPRequest'))
sets << Pod::Spec::Set.by_pod_dir(fixture('spec-repos/master/ASIWebPageRequest')) sets << Pod::Spec::Set.by_pod_dir(fixture('spec-repos/master/ASIWebPageRequest'))
resolver = Pod::Resolver.new(Pod::Spec.new { |s| s.dependency 'ASIWebPageRequest' }) resolver = Pod::Resolver.new(@podfile)
resolver.resolve.sort_by(&:name).should == sets.sort_by(&:name) resolver.resolve.sort_by(&:name).should == sets.sort_by(&:name)
end end
it "does not raise if all dependencies match the platform of the root spec (Podfile)" do it "does not raise if all dependencies match the platform of the root spec (Podfile)" do
spec = Pod::Spec.new { |s| s.dependency 'ASIWebPageRequest' } resolver = Pod::Resolver.new(@podfile)
resolver = Pod::Resolver.new(spec)
spec.platform = :ios @podfile.platform :ios
lambda { resolver.resolve }.should.not.raise lambda { resolver.resolve }.should.not.raise
spec.platform = :osx @podfile.platform :osx
lambda { resolver.resolve }.should.not.raise lambda { resolver.resolve }.should.not.raise
end end
it "raises once any of the dependencies does not match the platform of the root spec (Podfile)" do it "raises once any of the dependencies does not match the platform of the root spec (Podfile)" do
spec = Pod::Spec.new { |s| s.dependency 'ASIWebPageRequest' } resolver = StubbedResolver.new(config.rootspec)
resolver = StubbedResolver.new(spec)
spec.platform = :ios @podfile.platform :ios
resolver.stub_platform = :ios resolver.stub_platform = :ios
lambda { resolver.resolve }.should.not.raise lambda { resolver.resolve }.should.not.raise
resolver.stub_platform = :osx resolver.stub_platform = :osx
lambda { resolver.resolve }.should.raise Pod::Informative lambda { resolver.resolve }.should.raise Pod::Informative
spec.platform = :osx @podfile.platform :osx
resolver.stub_platform = :osx resolver.stub_platform = :osx
lambda { resolver.resolve }.should.not.raise lambda { resolver.resolve }.should.not.raise
resolver.stub_platform = :ios resolver.stub_platform = :ios
......
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