Permalink
Browse files

Specs for relative paths

  • Loading branch information...
1 parent e2c55cd commit 18ef8bf8e1e2c2d60cfe8c409437a28ad70ce663 @subdigital committed Feb 25, 2012
Showing with 30 additions and 1 deletion.
  1. +1 −1 lib/cocoapods/command/install.rb
  2. +29 −0 spec/unit/target_installer_spec.rb
@@ -27,7 +27,7 @@ def initialize(argv)
config.clean = !argv.option('--no-clean')
@update_repo = !argv.option('--no-update')
@projpath = argv.shift_argument
- config.source_root = @projpath
+ config.source_root = Pathname.new(@projpath) if @projpath
super unless argv.empty?
end
@@ -0,0 +1,29 @@
+require File.expand_path('../../spec_helper', __FILE__)
+
+describe "Pod::Installer::TargetInstaller" do
+ before do
+ @target_installer = Pod::Installer::TargetInstaller.new(nil, nil, nil)
+ @config_before = config
+ Pod::Config.instance = nil
+ end
+
+ it "should work with paths one level up" do
+ config.source_root = "#{config.project_root}/subdir"
+ @target_installer.pods_path_relative_to_project.to_s.should == "../Pods"
+ end
+
+ it "should work with paths at the same level" do
+ @target_installer.pods_path_relative_to_project.to_s.should == "Pods"
+ end
+
+ it "should work with paths one level up" do
+ config.project_root = Pathname.new("/tmp/foo")
+ config.source_root = "/tmp"
+ @target_installer.pods_path_relative_to_project.to_s.should == "foo/Pods"
+ end
+
+ after do
+ Pod::Config.instance = @config_before
+ end
+end
+

0 comments on commit 18ef8bf

Please sign in to comment.