Commit a088a783 authored by Michele's avatar Michele

Many test fixes.

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