Commit 018cb7f4 authored by Eloy Duran's avatar Eloy Duran

Make specs green.

parent 3bbee447
...@@ -7,8 +7,8 @@ describe "Pod::BridgeSupportGenerator" do ...@@ -7,8 +7,8 @@ describe "Pod::BridgeSupportGenerator" do
def generator.gen_bridge_metadata(command) def generator.gen_bridge_metadata(command)
@command = command @command = command
end end
generator.create_in(Pathname.new("/path/to/Pods")) generator.save_as(Pathname.new("/path/to/Pods.bridgesupport"))
generator.instance_variable_get(:@command).should == generator.instance_variable_get(:@command).should ==
%{-c "-I '/some/dir' -I '/some/other/dir'" -o '/path/to/Pods/Pods.bridgesupport' '#{headers.join("' '")}'} %{-c "-I '/some/dir' -I '/some/other/dir'" -o '/path/to/Pods.bridgesupport' '#{headers.join("' '")}'}
end end
end end
...@@ -3,7 +3,7 @@ require File.expand_path('../../spec_helper', __FILE__) ...@@ -3,7 +3,7 @@ require File.expand_path('../../spec_helper', __FILE__)
describe "Pod::Installer" do describe "Pod::Installer" do
describe ", by default," do describe ", by default," do
before do before do
@xcconfig = Pod::Installer.new(Pod::Spec.new).xcconfig.to_hash @xcconfig = Pod::Installer.new(Pod::Podfile.new { platform :ios }).targets.first.xcconfig.to_hash
end end
it "sets the header search paths where installed Pod headers can be found" do it "sets the header search paths where installed Pod headers can be found" do
...@@ -33,9 +33,9 @@ describe "Pod::Installer" do ...@@ -33,9 +33,9 @@ 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::Spec.new do |s| spec = Pod::Podfile.new do
s.platform = :osx platform :osx
s.dependency 'ASIHTTPRequest' dependency 'ASIHTTPRequest'
end end
expected = [] expected = []
installer = Pod::Installer.new(spec) installer = Pod::Installer.new(spec)
...@@ -44,71 +44,6 @@ describe "Pod::Installer" do ...@@ -44,71 +44,6 @@ describe "Pod::Installer" do
expected << config.project_pods_root + header expected << config.project_pods_root + header
end end
end end
installer.bridge_support_generator.headers.should == expected installer.targets.first.bridge_support_generator.headers.should == expected
end
it "adds all source files that should be included in the library to the xcode project" do
[
[
'ASIHTTPRequest',
['Classes'],
{ 'ASIHTTPRequest' => "Classes/*.{h,m}", 'Reachability' => "External/Reachability/*.{h,m}" },
{
"USER_HEADER_SEARCH_PATHS" => '"$(BUILT_PRODUCTS_DIR)/Pods" ' \
'"$(BUILT_PRODUCTS_DIR)/Pods/ASIHTTPRequest" ' \
'"$(BUILT_PRODUCTS_DIR)/Pods/Reachability"',
"ALWAYS_SEARCH_USER_PATHS" => "YES",
"OTHER_LDFLAGS" => "-ObjC -all_load " \
"-framework SystemConfiguration -framework MobileCoreServices " \
"-framework CFNetwork -lz.1"
}
],
[
'Reachability',
["External/Reachability/*.h", "External/Reachability/*.m"],
{ 'Reachability' => "External/Reachability/*.{h,m}", },
{
"USER_HEADER_SEARCH_PATHS" => '"$(BUILT_PRODUCTS_DIR)/Pods" ' \
'"$(BUILT_PRODUCTS_DIR)/Pods/Reachability"',
"ALWAYS_SEARCH_USER_PATHS" => "YES",
"OTHER_LDFLAGS" => "-ObjC -all_load"
}
],
[
'ASIWebPageRequest',
['**/ASIWebPageRequest.*'],
{ 'ASIHTTPRequest' => "Classes/*.{h,m}", 'ASIWebPageRequest' => "Classes/ASIWebPageRequest/*.{h,m}", 'Reachability' => "External/Reachability/*.{h,m}" },
{
"USER_HEADER_SEARCH_PATHS" => '"$(BUILT_PRODUCTS_DIR)/Pods" ' \
'"$(BUILT_PRODUCTS_DIR)/Pods/ASIHTTPRequest" ' \
'"$(BUILT_PRODUCTS_DIR)/Pods/Reachability"',
"ALWAYS_SEARCH_USER_PATHS" => "YES",
"HEADER_SEARCH_PATHS" => "$(SDKROOT)/usr/include/libxml2",
"OTHER_LDFLAGS" => "-ObjC -all_load " \
"-lxml2.2.7.3 -framework SystemConfiguration " \
"-framework MobileCoreServices -framework CFNetwork -lz.1"
}
],
].each do |name, patterns, expected_patterns, xcconfig|
Pod::Source.reset!
Pod::Spec::Set.reset!
installer = Pod::Installer.new(Pod::Spec.new do |s|
s.platform = :ios
s.dependency(name)
s.source_files = *patterns
end)
installer.generate_project
expected_patterns.each do |name, pattern|
pattern = config.project_pods_root + 'ASIHTTPRequest' + pattern
expected = pattern.glob.map do |file|
file.relative_path_from(config.project_pods_root)
end
installer.xcodeproj.source_files[name].size.should == expected.size
installer.xcodeproj.source_files[name].sort.should == expected.sort
end
installer.xcconfig.to_hash.should == xcconfig
end
end end
end end
...@@ -44,13 +44,13 @@ describe "Pod::Podfile" do ...@@ -44,13 +44,13 @@ describe "Pod::Podfile" do
it "adds dependencies outside of any explicit target block to the default target" do it "adds dependencies outside of any explicit target block to the default target" do
target = @podfile.targets[:default] target = @podfile.targets[:default]
target.lib_name.should == 'libPods' target.lib_name.should == 'Pods'
target.dependencies.should == [Pod::Dependency.new('ASIHTTPRequest')] target.dependencies.should == [Pod::Dependency.new('ASIHTTPRequest')]
end end
it "adds dependencies of the outer target to non-exclusive targets" do it "adds dependencies of the outer target to non-exclusive targets" do
target = @podfile.targets[:debug] target = @podfile.targets[:debug]
target.lib_name.should == 'libPods-debug' target.lib_name.should == 'Pods-debug'
target.dependencies.sort_by(&:name).should == [ target.dependencies.sort_by(&:name).should == [
Pod::Dependency.new('ASIHTTPRequest'), Pod::Dependency.new('ASIHTTPRequest'),
Pod::Dependency.new('SSZipArchive') Pod::Dependency.new('SSZipArchive')
...@@ -59,7 +59,7 @@ describe "Pod::Podfile" do ...@@ -59,7 +59,7 @@ describe "Pod::Podfile" do
it "does not add dependencies of the outer target to exclusive targets" do it "does not add dependencies of the outer target to exclusive targets" do
target = @podfile.targets[:test] target = @podfile.targets[:test]
target.lib_name.should == 'libPods-test' target.lib_name.should == 'Pods-test'
target.dependencies.should == [Pod::Dependency.new('JSONKit')] target.dependencies.should == [Pod::Dependency.new('JSONKit')]
end end
end end
......
...@@ -25,7 +25,7 @@ describe "Pod::Xcode::Config" do ...@@ -25,7 +25,7 @@ describe "Pod::Xcode::Config" do
it "creates the config file" do it "creates the config file" do
@config.merge!('HEADER_SEARCH_PATHS' => '/some/path') @config.merge!('HEADER_SEARCH_PATHS' => '/some/path')
@config.merge!('OTHER_LD_FLAGS' => '-l xml2.2.7.3') @config.merge!('OTHER_LD_FLAGS' => '-l xml2.2.7.3')
@config.create_in(temporary_directory) @config.save_as(temporary_directory + 'Pods.xcconfig')
(temporary_directory + 'Pods.xcconfig').read.split("\n").sort.should == [ (temporary_directory + 'Pods.xcconfig').read.split("\n").sort.should == [
"OTHER_LD_FLAGS = -framework Foundation -l xml2.2.7.3", "OTHER_LD_FLAGS = -framework Foundation -l xml2.2.7.3",
"HEADER_SEARCH_PATHS = /some/path" "HEADER_SEARCH_PATHS = /some/path"
......
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