Commit d9a36104 authored by Nolan Waite's avatar Nolan Waite

Use production podspecs as fixtures

 - One series of tests used ASIHTTPRequest as an example with many
   versions; switch to CocoaLumberjack.
parent 015ec385
...@@ -11,4 +11,3 @@ examples/Podfile ...@@ -11,4 +11,3 @@ examples/Podfile
examples/Pods examples/Pods
examples/**/Pods examples/**/Pods
spec/fixtures/banana-lib spec/fixtures/banana-lib
spec/fixtures/spec-repos/master
...@@ -7,3 +7,6 @@ ...@@ -7,3 +7,6 @@
[submodule "spec/fixtures/integration/JSONKit"] [submodule "spec/fixtures/integration/JSONKit"]
path = spec/fixtures/integration/JSONKit path = spec/fixtures/integration/JSONKit
url = https://github.com/johnezang/JSONKit.git url = https://github.com/johnezang/JSONKit.git
[submodule "spec/fixtures/spec-repos/master"]
path = spec/fixtures/spec-repos/master
url = git://github.com/alloy/cocoapods-specs.git
Subproject commit 03c0745a874c44b58a9b789846bfcda1726c871f
...@@ -68,10 +68,10 @@ describe "Pod::Command" do ...@@ -68,10 +68,10 @@ describe "Pod::Command" do
[ [
[ [
' s ', ' s ',
"==> ASIHTTPRequest (1.8, 1.8.1)\n" \ "==> ASIHTTPRequest (1.8.1)\n" \
" Easy to use CFNetwork wrapper for HTTP requests, Objective-C, " \ " Easy to use CFNetwork wrapper for HTTP requests, Objective-C, " \
"Mac OS X and iPhone\n\n" \ "Mac OS X and iPhone\n\n" \
"==> ASIWebPageRequest (1.8, 1.8.1)\n" \ "==> ASIWebPageRequest (1.8.1)\n" \
" The ASIWebPageRequest class included with ASIHTTPRequest lets you " \ " The ASIWebPageRequest class included with ASIHTTPRequest lets you " \
"download\n complete webpages, including external resources like " \ "download\n complete webpages, including external resources like " \
"images and stylesheets.\n\n" \ "images and stylesheets.\n\n" \
...@@ -92,7 +92,7 @@ describe "Pod::Command" do ...@@ -92,7 +92,7 @@ describe "Pod::Command" do
end end
command.run command.run
printed = command.instance_variable_get(:@printed) printed = command.instance_variable_get(:@printed)
printed.should == result result.split("\n\n").each { |pod| printed.should.include? pod }
end end
end end
...@@ -105,7 +105,7 @@ describe "Pod::Command" do ...@@ -105,7 +105,7 @@ describe "Pod::Command" do
], ],
[ [
'is', 'is',
"==> ASIHTTPRequest (1.8, 1.8.1)\n" \ "==> ASIHTTPRequest (1.8.1)\n" \
" Easy to use CFNetwork wrapper for HTTP requests, Objective-C, " \ " Easy to use CFNetwork wrapper for HTTP requests, Objective-C, " \
"Mac OS X and iPhone\n\n" \ "Mac OS X and iPhone\n\n" \
"==> Reachability (2.0.4)\n" \ "==> Reachability (2.0.4)\n" \
...@@ -120,7 +120,7 @@ describe "Pod::Command" do ...@@ -120,7 +120,7 @@ describe "Pod::Command" do
end end
command.run command.run
printed = command.instance_variable_get(:@printed) printed = command.instance_variable_get(:@printed)
printed.should == result result.split("\n\n").each { |pod| printed.should.include? pod }
end end
end end
end end
...@@ -85,7 +85,7 @@ describe "Pod::Installer" do ...@@ -85,7 +85,7 @@ describe "Pod::Installer" do
"ALWAYS_SEARCH_USER_PATHS" => "YES", "ALWAYS_SEARCH_USER_PATHS" => "YES",
"HEADER_SEARCH_PATHS" => "$(SDKROOT)/usr/include/libxml2", "HEADER_SEARCH_PATHS" => "$(SDKROOT)/usr/include/libxml2",
"OTHER_LDFLAGS" => "-ObjC -all_load " \ "OTHER_LDFLAGS" => "-ObjC -all_load " \
"-l xml2.2.7.3 -framework SystemConfiguration " \ "-lxml2.2.7.3 -framework SystemConfiguration " \
"-framework MobileCoreServices -framework CFNetwork -lz.1" "-framework MobileCoreServices -framework CFNetwork -lz.1"
} }
], ],
......
...@@ -22,7 +22,6 @@ end ...@@ -22,7 +22,6 @@ end
describe "Pod::Resolver" do describe "Pod::Resolver" do
before do before do
fixture('spec-repos/master') # ensure the archive is unpacked
@config_before = config @config_before = config
Pod::Config.instance = nil Pod::Config.instance = nil
config.silent = true config.silent = true
......
...@@ -9,76 +9,76 @@ end ...@@ -9,76 +9,76 @@ end
describe "Pod::Specification::Set" do describe "Pod::Specification::Set" do
it "returns nil in case a set hasn't been resolved yet" do it "returns nil in case a set hasn't been resolved yet" do
Pod::Spec::Set.reset! Pod::Spec::Set.reset!
Pod::Spec::Set.by_specification_name('ASIHTTPRequest').should == nil Pod::Spec::Set.by_specification_name('CocoaLumberjack').should == nil
end end
before do before do
@set = Pod::Spec::Set.by_pod_dir(fixture('spec-repos/master/ASIHTTPRequest')) @set = Pod::Spec::Set.by_pod_dir(fixture('spec-repos/master/CocoaLumberjack'))
@set.reset! @set.reset!
end end
it "returns a cached set by name once it has been resolved once" do it "returns a cached set by name once it has been resolved once" do
Pod::Spec::Set.by_specification_name('ASIHTTPRequest').should.eql @set Pod::Spec::Set.by_specification_name('CocoaLumberjack').should.eql @set
end end
it "always returns the same set instance for a pod dir" do it "always returns the same set instance for a pod dir" do
Pod::Spec::Set.by_pod_dir(fixture('spec-repos/master/ASIHTTPRequest')).should.eql @set Pod::Spec::Set.by_pod_dir(fixture('spec-repos/master/CocoaLumberjack')).should.eql @set
end end
it "returns the name of the pod" do it "returns the name of the pod" do
@set.name.should == 'ASIHTTPRequest' @set.name.should == 'CocoaLumberjack'
end end
it "returns the versions available for this pod ordered from highest to lowest" do it "returns the versions available for this pod ordered from highest to lowest" do
@set.versions.should == [Pod::Version.new('1.8.1'), Pod::Version.new('1.8')] @set.versions.should == %w[1.2.1 1.2 1.1 1.0].map { |v| Pod::Version.new(v) }
end end
it "checks if the dependency of the specification is compatible with existing requirements" do it "checks if the dependency of the specification is compatible with existing requirements" do
@set.required_by(Pod::Spec.new { |s| s.dependency 'ASIHTTPRequest', '1.8' }) @set.required_by(Pod::Spec.new { |s| s.dependency 'CocoaLumberjack', '1.2' })
@set.required_by(Pod::Spec.new { |s| s.dependency 'ASIHTTPRequest', '< 1.8.1' }) @set.required_by(Pod::Spec.new { |s| s.dependency 'CocoaLumberjack', '< 1.2.1' })
@set.required_by(Pod::Spec.new { |s| s.dependency 'ASIHTTPRequest', '> 1.7.9' }) @set.required_by(Pod::Spec.new { |s| s.dependency 'CocoaLumberjack', '> 1.1' })
@set.required_by(Pod::Spec.new { |s| s.dependency 'ASIHTTPRequest', '~> 1.8.0' }) @set.required_by(Pod::Spec.new { |s| s.dependency 'CocoaLumberjack', '~> 1.2.0' })
@set.required_by(Pod::Spec.new { |s| s.dependency 'ASIHTTPRequest' }) @set.required_by(Pod::Spec.new { |s| s.dependency 'CocoaLumberjack' })
lambda { lambda {
@set.required_by(Pod::Spec.new { |s| s.dependency 'ASIHTTPRequest', '< 1.8' }) @set.required_by(Pod::Spec.new { |s| s.dependency 'CocoaLumberjack', '< 1.0' })
}.should.raise Pod::Informative }.should.raise Pod::Informative
end end
it "raises if the required version doesn't exist" do it "raises if the required version doesn't exist" do
@set.required_by(Pod::Spec.new { |s| s.dependency 'ASIHTTPRequest', '< 1.8' }) @set.required_by(Pod::Spec.new { |s| s.dependency 'CocoaLumberjack', '< 1.0' })
lambda { @set.required_version }.should.raise Pod::Informative lambda { @set.required_version }.should.raise Pod::Informative
end end
before do before do
@set.required_by(Pod::Spec.new { |s| s.dependency 'ASIHTTPRequest', '< 1.8.1' }) @set.required_by(Pod::Spec.new { |s| s.dependency 'CocoaLumberjack', '< 1.2.1' })
end end
it "returns the version required for the dependency" do it "returns the version required for the dependency" do
@set.required_version.should == Pod::Version.new('1.8') @set.required_version.should == Pod::Version.new('1.2')
end end
it "returns the path to the specification for the required version" do it "returns the path to the specification for the required version" do
@set.specification_path.should == fixture('spec-repos/master/ASIHTTPRequest/1.8/ASIHTTPRequest.podspec') @set.specification_path.should == fixture('spec-repos/master/CocoaLumberjack/1.2/CocoaLumberjack.podspec')
end end
it "returns the specification for the required version" do it "returns the specification for the required version" do
@set.specification.should == Pod::Spec.new { |s| s.name = 'ASIHTTPRequest'; s.version = '1.8' } @set.specification.should == Pod::Spec.new { |s| s.name = 'CocoaLumberjack'; s.version = '1.2' }
end end
it "returns that this set is not only part for other pods" do it "returns that this set is not only part for other pods" do
@set.required_by(Pod::Spec.new { |s| s.part_of = 'ASIHTTPRequest' }) @set.required_by(Pod::Spec.new { |s| s.part_of = 'CocoaLumberjack' })
@set.should.not.be.only_part_of_other_pod @set.should.not.be.only_part_of_other_pod
end end
it "returns that this set is only part for other pods" do it "returns that this set is only part for other pods" do
@set.reset! @set.reset!
@set.required_by(Pod::Spec.new { |s| s.part_of = 'ASIHTTPRequest' }) @set.required_by(Pod::Spec.new { |s| s.part_of = 'CocoaLumberjack' })
@set.required_by(Pod::Spec.new { |s| s.part_of = 'ASIHTTPRequest' }) @set.required_by(Pod::Spec.new { |s| s.part_of = 'CocoaLumberjack' })
@set.should.be.only_part_of_other_pod @set.should.be.only_part_of_other_pod
end end
it "ignores dotfiles when getting the version directories" do it "ignores dotfiles when getting the version directories" do
`touch #{fixture('spec-repos/master/ASIHTTPRequest/.DS_Store')}` `touch #{fixture('spec-repos/master/CocoaLumberjack/.DS_Store')}`
lambda { @set.versions }.should.not.raise lambda { @set.versions }.should.not.raise
end end
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