Commit a088a783 authored by Michele's avatar Michele

Many test fixes.

parent 5283a9f4
...@@ -76,7 +76,7 @@ module Pod ...@@ -76,7 +76,7 @@ module Pod
it "generates the libraries which represent the target definitions" do it "generates the libraries which represent the target definitions" do
libs = @analyzer.analyze.libraries libs = @analyzer.analyze.libraries
libs.map(&:name).should == ['Pods'] libs.map(&:name).should == ['Pods/Generated']
lib = libs.first lib = libs.first
lib.support_files_root.should == config.sandbox.root lib.support_files_root.should == config.sandbox.root
......
...@@ -23,9 +23,9 @@ module Pod ...@@ -23,9 +23,9 @@ module Pod
it "adds the files references of the source files the Pods project" do it "adds the files references of the source files the Pods project" do
@installer.install! @installer.install!
group_ref = @installer.pods_project['Pods/BananaLib'] group_ref = @installer.pods_project['Pods/Generated/Sources/BananaLib']
group_ref.should.be.not.nil group_ref.should.be.not.nil
file_ref = @installer.pods_project['Pods/BananaLib/Banana.m'] file_ref = @installer.pods_project['Pods/Generated/Sources/BananaLib/Banana.m']
file_ref.should.be.not.nil file_ref.should.be.not.nil
file_ref.path.should == "../../spec/fixtures/banana-lib/Classes/Banana.m" file_ref.path.should == "../../spec/fixtures/banana-lib/Classes/Banana.m"
end end
......
...@@ -70,14 +70,14 @@ module Pod ...@@ -70,14 +70,14 @@ module Pod
it "cleans the paths non used by the installation" do it "cleans the paths non used by the installation" do
@installer.install! @installer.install!
@installer.clean! @installer.clean!
unused_file = config.sandbox.root + 'Sources/BananaLib/sub-dir/sub-dir-2/somefile.txt' unused_file = config.sandbox.root + 'Generated/Sources/BananaLib/sub-dir/sub-dir-2/somefile.txt'
unused_file.should.not.exist unused_file.should.not.exist
end end
it "preserves important files like the LICENSE and the README" do it "preserves important files like the LICENSE and the README" do
@installer.install! @installer.install!
@installer.clean! @installer.clean!
readme_file = config.sandbox.root + 'Sources/BananaLib/README' readme_file = config.sandbox.root + 'Generated/Sources/BananaLib/README'
readme_file.should.exist readme_file.should.exist
end end
...@@ -120,13 +120,13 @@ module Pod ...@@ -120,13 +120,13 @@ module Pod
@installer.send(:download_source) @installer.send(:download_source)
paths = @installer.send(:clean_paths) paths = @installer.send(:clean_paths)
relative_paths = paths.map { |p| p.gsub("#{temporary_directory}/", '')} relative_paths = paths.map { |p| p.gsub("#{temporary_directory}/", '')}
paths_without_git = relative_paths.reject { |p| p.include? 'Pods/Sources/BananaLib/.git' } paths_without_git = relative_paths.reject { |p| p.include? 'Pods/Generated/Sources/BananaLib/.git' }
paths_without_git.sort.should == [ paths_without_git.sort.should == [
"Pods/Sources/BananaLib/BananaLib.podspec", "Pods/Generated/Sources/BananaLib/BananaLib.podspec",
"Pods/Sources/BananaLib/libPusher", "Pods/Generated/Sources/BananaLib/libPusher",
"Pods/Sources/BananaLib/sub-dir", "Pods/Generated/Sources/BananaLib/sub-dir",
"Pods/Sources/BananaLib/sub-dir/sub-dir-2", "Pods/Generated/Sources/BananaLib/sub-dir/sub-dir-2",
"Pods/Sources/BananaLib/sub-dir/sub-dir-2/somefile.txt" "Pods/Generated/Sources/BananaLib/sub-dir/sub-dir-2/somefile.txt"
] ]
end end
...@@ -135,13 +135,13 @@ module Pod ...@@ -135,13 +135,13 @@ module Pod
paths = @installer.send(:used_files) paths = @installer.send(:used_files)
relative_paths = paths.map { |p| p.gsub("#{temporary_directory}/", '')} relative_paths = paths.map { |p| p.gsub("#{temporary_directory}/", '')}
relative_paths.sort.should == [ relative_paths.sort.should == [
"Pods/Sources/BananaLib/Classes/Banana.h", "Pods/Generated/Sources/BananaLib/Classes/Banana.h",
"Pods/Sources/BananaLib/Classes/Banana.m", "Pods/Generated/Sources/BananaLib/Classes/Banana.m",
"Pods/Sources/BananaLib/Classes/BananaLib.pch", "Pods/Generated/Sources/BananaLib/Classes/BananaLib.pch",
"Pods/Sources/BananaLib/Classes/BananaPrivate.h", "Pods/Generated/Sources/BananaLib/Classes/BananaPrivate.h",
"Pods/Sources/BananaLib/LICENSE", "Pods/Generated/Sources/BananaLib/LICENSE",
"Pods/Sources/BananaLib/README", "Pods/Generated/Sources/BananaLib/README",
"Pods/Sources/BananaLib/Resources/logo-sidebar.png" "Pods/Generated/Sources/BananaLib/Resources/logo-sidebar.png"
] ]
end end
...@@ -159,13 +159,13 @@ module Pod ...@@ -159,13 +159,13 @@ module Pod
paths = @installer.send(:used_files) paths = @installer.send(:used_files)
relative_paths = paths.map { |p| p.gsub("#{temporary_directory}/", '')} relative_paths = paths.map { |p| p.gsub("#{temporary_directory}/", '')}
relative_paths.sort.should == [ relative_paths.sort.should == [
"Pods/Sources/BananaLib/Classes/Banana.h", "Pods/Generated/Sources/BananaLib/Classes/Banana.h",
"Pods/Sources/BananaLib/Classes/Banana.m", "Pods/Generated/Sources/BananaLib/Classes/Banana.m",
"Pods/Sources/BananaLib/Classes/BananaLib.pch", "Pods/Generated/Sources/BananaLib/Classes/BananaLib.pch",
"Pods/Sources/BananaLib/Classes/BananaPrivate.h", "Pods/Generated/Sources/BananaLib/Classes/BananaPrivate.h",
"Pods/Sources/BananaLib/LICENSE", "Pods/Generated/Sources/BananaLib/LICENSE",
"Pods/Sources/BananaLib/README", "Pods/Generated/Sources/BananaLib/README",
"Pods/Sources/BananaLib/Resources/logo-sidebar.png" "Pods/Generated/Sources/BananaLib/Resources/logo-sidebar.png"
] ]
end end
......
...@@ -17,7 +17,7 @@ module Pod ...@@ -17,7 +17,7 @@ module Pod
path_list = Sandbox::PathList.new(fixture('banana-lib')) path_list = Sandbox::PathList.new(fixture('banana-lib'))
@spec = fixture_spec('banana-lib/BananaLib.podspec') @spec = fixture_spec('banana-lib/BananaLib.podspec')
file_accessor = Sandbox::FileAccessor.new(path_list, @spec.consumer(:ios)) file_accessor = Sandbox::FileAccessor.new(path_list, @spec.consumer(:ios))
@project.add_file_references(file_accessor.source_files, 'BananaLib', @project.pods) @project.add_file_references(file_accessor.source_files, 'Sources/BananaLib', @project.pods)
@library = Library.new(@target_definition) @library = Library.new(@target_definition)
@library.platform = Platform.new(:ios, '6.0') @library.platform = Platform.new(:ios, '6.0')
......
...@@ -62,7 +62,7 @@ module Pod ...@@ -62,7 +62,7 @@ module Pod
saved = Xcodeproj::Workspace.new_from_xcworkspace(workspace_path) saved = Xcodeproj::Workspace.new_from_xcworkspace(workspace_path)
saved.projpaths.should == [ saved.projpaths.should == [
"SampleProject/SampleProject.xcodeproj", "SampleProject/SampleProject.xcodeproj",
"Pods/Pods.xcodeproj" "Pods/Generated/Pods.xcodeproj"
] ]
end end
...@@ -74,14 +74,14 @@ module Pod ...@@ -74,14 +74,14 @@ module Pod
saved = Xcodeproj::Workspace.new_from_xcworkspace(workspace_path) saved = Xcodeproj::Workspace.new_from_xcworkspace(workspace_path)
saved.projpaths.should == [ saved.projpaths.should == [
"SampleProject/SampleProject.xcodeproj", "SampleProject/SampleProject.xcodeproj",
"Pods/Pods.xcodeproj" "Pods/Generated/Pods.xcodeproj"
] ]
end end
it "doesn't write the workspace if not needed" do it "doesn't write the workspace if not needed" do
projpaths = [ projpaths = [
"SampleProject/SampleProject.xcodeproj", "SampleProject/SampleProject.xcodeproj",
"Pods/Pods.xcodeproj" "Pods/Generated/Pods.xcodeproj"
] ]
workspace = Xcodeproj::Workspace.new(projpaths) workspace = Xcodeproj::Workspace.new(projpaths)
workspace_path = @integrator.send(:workspace_path) workspace_path = @integrator.send(:workspace_path)
...@@ -99,13 +99,13 @@ module Pod ...@@ -99,13 +99,13 @@ module Pod
saved.projpaths.should == [ saved.projpaths.should == [
'user_added_project.xcodeproj', 'user_added_project.xcodeproj',
"SampleProject/SampleProject.xcodeproj", "SampleProject/SampleProject.xcodeproj",
"Pods/Pods.xcodeproj" "Pods/Generated/Pods.xcodeproj"
] ]
end end
it "preserves the order of the projects in the workspace" do it "preserves the order of the projects in the workspace" do
projpaths = [ projpaths = [
"Pods/Pods.xcodeproj", "Pods/Generated/Pods.xcodeproj",
"SampleProject/SampleProject.xcodeproj", "SampleProject/SampleProject.xcodeproj",
] ]
workspace = Xcodeproj::Workspace.new(projpaths) workspace = Xcodeproj::Workspace.new(projpaths)
...@@ -114,7 +114,7 @@ module Pod ...@@ -114,7 +114,7 @@ module Pod
@integrator.send(:create_workspace) @integrator.send(:create_workspace)
saved = Xcodeproj::Workspace.new_from_xcworkspace(workspace_path) saved = Xcodeproj::Workspace.new_from_xcworkspace(workspace_path)
saved.projpaths.should == [ saved.projpaths.should == [
"Pods/Pods.xcodeproj", "Pods/Generated/Pods.xcodeproj",
"SampleProject/SampleProject.xcodeproj", "SampleProject/SampleProject.xcodeproj",
] ]
end end
......
...@@ -297,7 +297,7 @@ module Pod ...@@ -297,7 +297,7 @@ module Pod
end end
it "saves the project to the given path" do it "saves the project to the given path" do
path = temporary_directory + 'Pods/Pods.xcodeproj' path = temporary_directory + 'Pods/Generated/Pods.xcodeproj'
@installer.pods_project.expects(:save_as).with(path) @installer.pods_project.expects(:save_as).with(path)
@installer.send(:write_pod_project) @installer.send(:write_pod_project)
end end
...@@ -327,7 +327,7 @@ module Pod ...@@ -327,7 +327,7 @@ module Pod
it "writes the sandbox manifest" do it "writes the sandbox manifest" do
@installer.send(:write_lockfiles) @installer.send(:write_lockfiles)
lockfile = Lockfile.from_file(temporary_directory + 'Pods/Manifest.lock') lockfile = Lockfile.from_file(temporary_directory + 'Pods/Generated/Manifest.lock')
lockfile.pod_names.should == ['BananaLib'] lockfile.pod_names.should == ['BananaLib']
end end
......
...@@ -16,13 +16,13 @@ module Pod ...@@ -16,13 +16,13 @@ module Pod
end end
it "can return the relative path of a given absolute path" do it "can return the relative path of a given absolute path" do
path = temporary_directory + 'Pods/Sources/BananaLib/file' path = temporary_directory + 'Pods/BananaLib/file'
@project.relativize(path).should == Pathname.new('Sources/BananaLib/file') @project.relativize(path).should == Pathname.new('../BananaLib/file')
end end
it "can return the relative path of a given absolute path outside its root" do it "can return the relative path of a given absolute path outside its root" do
path = temporary_directory + 'file' path = temporary_directory + 'file'
@project.relativize(path).should == Pathname.new('../file') @project.relativize(path).should == Pathname.new('../../file')
end end
it "can return the relative path of a given absolute path with another root directory" do it "can return the relative path of a given absolute path with another root directory" do
...@@ -73,7 +73,7 @@ module Pod ...@@ -73,7 +73,7 @@ module Pod
describe "File references" do describe "File references" do
it "adds the file references for the given source files" do it "adds the file references for the given source files" do
source_files = [ config.sandbox.root + "A_POD/some_file.m" ] source_files = [ config.sandbox.pod_dir("A_POD") + "some_file.m" ]
@project.add_file_references(source_files, 'BananaLib', @project.pods) @project.add_file_references(source_files, 'BananaLib', @project.pods)
group = @project['Pods/BananaLib'] group = @project['Pods/BananaLib']
group.should.not.be.nil group.should.not.be.nil
......
...@@ -9,15 +9,15 @@ module Pod ...@@ -9,15 +9,15 @@ module Pod
end end
it "returns it's headers root" do it "returns it's headers root" do
@header_dir.root.should == temporary_directory + 'Sandbox/Headers' @header_dir.root.should == temporary_directory + 'Sandbox/Generated/Headers/Headers'
end end
it "can add namespaced headers to it's header path using symlinks and return the relative path" do it "can add namespaced headers to it's header path using symlinks and return the relative path" do
FileUtils.mkdir_p(@sandbox.root + "ExampleLib/") FileUtils.mkdir_p(@sandbox.pod_dir("ExampleLib"))
namespace_path = Pathname.new("ExampleLib") namespace_path = Pathname.new("Generated/Sources/ExampleLib")
relative_header_paths = [ relative_header_paths = [
Pathname.new("ExampleLib/MyHeader.h"), Pathname.new("Generated/Sources/ExampleLib/MyHeader.h"),
Pathname.new("ExampleLib/MyOtherHeader.h") Pathname.new("Generated/Sources/ExampleLib/MyOtherHeader.h")
] ]
relative_header_paths.each do |path| relative_header_paths.each do |path|
File.open(@sandbox.root + path, "w") { |file| file.write('hello') } File.open(@sandbox.root + path, "w") { |file| file.write('hello') }
...@@ -30,11 +30,11 @@ module Pod ...@@ -30,11 +30,11 @@ module Pod
end end
it 'keeps a list of unique header search paths when headers are added' do it 'keeps a list of unique header search paths when headers are added' do
FileUtils.mkdir_p(@sandbox.root + "ExampleLib/Dir") FileUtils.mkdir_p(@sandbox.sources_root + "ExampleLib/Dir")
namespace_path = Pathname.new("ExampleLib") namespace_path = Pathname.new("ExampleLib")
relative_header_paths = [ relative_header_paths = [
Pathname.new("ExampleLib/Dir/MyHeader.h"), Pathname.new("Generated/Sources/ExampleLib/Dir/MyHeader.h"),
Pathname.new("ExampleLib/Dir/MyOtherHeader.h") Pathname.new("Generated/Sources/ExampleLib/Dir/MyOtherHeader.h")
] ]
relative_header_paths.each do |path| relative_header_paths.each do |path|
File.open(@sandbox.root + path, "w") { |file| file.write('hello') } File.open(@sandbox.root + path, "w") { |file| file.write('hello') }
......
...@@ -24,16 +24,16 @@ module Pod ...@@ -24,16 +24,16 @@ module Pod
end end
it "returns the public headers store" do it "returns the public headers store" do
@sandbox.public_headers.root.should == temporary_directory + 'Sandbox/Headers' @sandbox.public_headers.root.should == temporary_directory + 'Sandbox/Generated/Headers/Headers'
end end
it "returns the build headers store" do it "returns the build headers store" do
@sandbox.build_headers.root.should == temporary_directory + 'Sandbox/BuildHeaders' @sandbox.build_headers.root.should == temporary_directory + 'Sandbox/Generated/Headers/BuildHeaders'
end end
it "deletes the entire root directory on implode" do it "deletes the entire root directory on implode" do
@sandbox.implode @sandbox.implode
File.directory?(temporary_directory + 'Sandbox').should.be.false File.directory?(temporary_directory + 'Sandbox/Generated').should.be.false
end end
it "cleans any trace of the Pod with the given name" do it "cleans any trace of the Pod with the given name" do
...@@ -61,19 +61,19 @@ module Pod ...@@ -61,19 +61,19 @@ module Pod
describe "Paths" do describe "Paths" do
it "returns the path of the manifest" do it "returns the path of the manifest" do
@sandbox.manifest_path.should == temporary_directory + 'Sandbox/Manifest.lock' @sandbox.manifest_path.should == temporary_directory + 'Sandbox/Generated/Manifest.lock'
end end
it "returns the path of the Pods project" do it "returns the path of the Pods project" do
@sandbox.project_path.should == temporary_directory + 'Sandbox/Pods.xcodeproj' @sandbox.project_path.should == temporary_directory + 'Sandbox/Generated/Pods.xcodeproj'
end end
it "returns the directory for the support files of a library" do it "returns the directory for the support files of a library" do
@sandbox.library_support_files_dir('Pods').should == temporary_directory + 'Sandbox' @sandbox.library_support_files_dir('Pods').should == temporary_directory + 'Sandbox/Generated'
end end
it "returns the directory where a Pod is stored" do it "returns the directory where a Pod is stored" do
@sandbox.pod_dir('JSONKit').should == temporary_directory + 'Sandbox/Sources/JSONKit' @sandbox.pod_dir('JSONKit').should == temporary_directory + 'Sandbox/Generated/Sources/JSONKit'
end end
it "returns the directory where a local Pod is stored" do it "returns the directory where a local Pod is stored" do
...@@ -81,8 +81,8 @@ module Pod ...@@ -81,8 +81,8 @@ module Pod
@sandbox.pod_dir('BananaLib').should.be == Pathname.new('Some Path') @sandbox.pod_dir('BananaLib').should.be == Pathname.new('Some Path')
end end
it "returns the directory where to store the documentation" do it "returns the directory where to store generated files" do
@sandbox.documentation_dir.should == temporary_directory + 'Sandbox/Documentation' @sandbox.generated_dir_root.should == temporary_directory + 'Sandbox/Generated'
end end
end end
...@@ -91,24 +91,26 @@ module Pod ...@@ -91,24 +91,26 @@ module Pod
describe "Specification store" do describe "Specification store" do
it "loads the stored specification with the given name" do it "loads the stored specification with the given name" do
(@sandbox.root + 'Local Podspecs').mkdir (@sandbox.root + 'Generated').mkdir
FileUtils.cp(fixture('banana-lib/BananaLib.podspec'), @sandbox.root + 'Local Podspecs') (@sandbox.root + 'Generated/Local Podspecs').mkdir
FileUtils.cp(fixture('banana-lib/BananaLib.podspec'), @sandbox.root + 'Generated/Local Podspecs')
@sandbox.specification('BananaLib').name.should == 'BananaLib' @sandbox.specification('BananaLib').name.should == 'BananaLib'
end end
it "returns the directory where to store the specifications" do it "returns the directory where to store the specifications" do
@sandbox.specifications_dir.should == temporary_directory + 'Sandbox/Local Podspecs' @sandbox.specifications_dir.should == temporary_directory + 'Sandbox/Generated/Local Podspecs'
end end
it "returns the path to a spec file in the 'Local Podspecs' dir" do it "returns the path to a spec file in the 'Local Podspecs' dir" do
(@sandbox.root + 'Local Podspecs').mkdir (@sandbox.root + 'Generated').mkdir
FileUtils.cp(fixture('banana-lib/BananaLib.podspec'), @sandbox.root + 'Local Podspecs') (@sandbox.root + 'Generated/Local Podspecs').mkdir
@sandbox.specification_path('BananaLib').should == @sandbox.root + 'Local Podspecs/BananaLib.podspec' FileUtils.cp(fixture('banana-lib/BananaLib.podspec'), @sandbox.root + 'Generated/Local Podspecs')
@sandbox.specification_path('BananaLib').should == @sandbox.root + 'Generated/Local Podspecs/BananaLib.podspec'
end end
it "stores a podspec with a given path into the sandbox" do it "stores a podspec with a given path into the sandbox" do
@sandbox.store_podspec('BananaLib', fixture('banana-lib/BananaLib.podspec')) @sandbox.store_podspec('BananaLib', fixture('banana-lib/BananaLib.podspec'))
path = @sandbox.root + 'Local Podspecs/BananaLib.podspec' path = @sandbox.root + 'Generated/Local Podspecs/BananaLib.podspec'
path.should.exist path.should.exist
@sandbox.specification_path('BananaLib').should == path @sandbox.specification_path('BananaLib').should == path
end end
...@@ -116,7 +118,7 @@ module Pod ...@@ -116,7 +118,7 @@ module Pod
it "stores a podspec with the given string into the sandbox" do it "stores a podspec with the given string into the sandbox" do
podspec_string = fixture('banana-lib/BananaLib.podspec').read podspec_string = fixture('banana-lib/BananaLib.podspec').read
@sandbox.store_podspec('BananaLib', podspec_string) @sandbox.store_podspec('BananaLib', podspec_string)
path = @sandbox.root + 'Local Podspecs/BananaLib.podspec' path = @sandbox.root + 'Generated/Local Podspecs/BananaLib.podspec'
path.should.exist path.should.exist
@sandbox.specification_path('BananaLib').should == path @sandbox.specification_path('BananaLib').should == path
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