Skip to content

Commit

Permalink
Specs for relative paths
Browse files Browse the repository at this point in the history
  • Loading branch information
subdigital committed Feb 25, 2012
1 parent e2c55cd commit 18ef8bf
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/cocoapods/command/install.rb
Expand Up @@ -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

Expand Down
29 changes: 29 additions & 0 deletions spec/unit/target_installer_spec.rb
@@ -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.