Permalink
Browse files

Fix command specs

  • Loading branch information...
1 parent ed5e567 commit b64c0c1f17c4387dcc8b02ddf1d94238438380a4 @alloy alloy committed Sep 14, 2011
Showing with 12 additions and 17 deletions.
  1. +1 −1 lib/cocoa_pods/command.rb
  2. +1 −1 lib/cocoa_pods/command/setup.rb
  3. +7 −12 spec/functional/command_spec.rb
  4. +3 −3 spec/spec_helper/git.rb
@@ -23,7 +23,7 @@ def message
end
class ARGV < Array
- def options; select { |x| x[0,1] == '-' }; end
+ def options; select { |x| x.to_s[0,1] == '-' }; end
def arguments; self - options; end
def option(name); !!delete(name); end
def shift_argument; (arg = arguments[0]) && delete(arg); end
@@ -21,7 +21,7 @@ def master_repo_url
end
def add_master_repo_command
- @command ||= Repo.new('add', 'master', master_repo_url)
+ @command ||= Repo.new(ARGV.new(['add', 'master', master_repo_url]))
end
def run
@@ -1,8 +1,6 @@
require File.expand_path('../../spec_helper', __FILE__)
-require 'executioner'
describe "Pod::Command" do
- extend SpecHelper::Fixture
extend SpecHelper::Git
extend SpecHelper::Log
extend SpecHelper::TemporaryDirectory
@@ -14,45 +12,42 @@
it "creates the local spec-repos directory and creates a clone of the `master' repo" do
command = Pod::Command.parse('setup')
def command.master_repo_url; SpecHelper.fixture('master-spec-repo.git'); end
- def (command.add_master_repo_command).repos_dir; SpecHelper.tmp_repos_path; end
-
command.run
- git_config('master', 'remote.origin.url').should == fixture('master-spec-repo.git')
+ git_config('master', 'remote.origin.url').should == fixture('master-spec-repo.git').to_s
end
def command(*argv)
command = Pod::Command.parse(*argv)
- def command.repos_dir; SpecHelper.tmp_repos_path; end
command.run
command
end
it "adds a spec-repo" do
command('repo', 'add', 'private', fixture('master-spec-repo.git'))
- git_config('private', 'remote.origin.url').should == fixture('master-spec-repo.git')
+ git_config('private', 'remote.origin.url').should == fixture('master-spec-repo.git').to_s
end
it "updates a spec-repo" do
repo1 = command('repo', 'add', 'repo1', fixture('master-spec-repo.git'))
repo2 = command('repo', 'add', 'repo2', repo1.dir)
- File.open(File.join(repo1.dir, 'README'), 'a') { |f| f << 'updated!' }
+ (repo1.dir + 'README').open('a') { |f| f << 'updated!' }
git('repo1', 'commit -a -m "update"')
command('repo', 'update', 'repo2')
- File.read(File.join(repo2.dir, 'README')).should.include 'updated!'
+ (repo2.dir + 'README').read.should.include 'updated!'
end
it "updates all the spec-repos" do
repo1 = command('repo', 'add', 'repo1', fixture('master-spec-repo.git'))
repo2 = command('repo', 'add', 'repo2', repo1.dir)
repo3 = command('repo', 'add', 'repo3', repo1.dir)
- File.open(File.join(repo1.dir, 'README'), 'a') { |f| f << 'updated!' }
+ (repo1.dir + 'README').open('a') { |f| f << 'updated!' }
git('repo1', 'commit -a -m "update"')
command('repo', 'update')
- File.read(File.join(repo2.dir, 'README')).should.include 'updated!'
- File.read(File.join(repo3.dir, 'README')).should.include 'updated!'
+ (repo2.dir + 'README').read.should.include 'updated!'
+ (repo3.dir + 'README').read.should.include 'updated!'
end
end
View
@@ -8,20 +8,20 @@ def self.tmp_repos_path
module Git
def tmp_repos_path
- File.join(SpecHelper.temporary_directory, 'cocoa-pods')
+ SpecHelper.temporary_directory + 'cocoa-pods'
end
module_function :tmp_repos_path
def tmp_master_repo_path
- File.join(tmp_repos_path, 'master')
+ tmp_repos_path + 'master'
end
include Executioner
executable :git
alias_method :git_super, :git
def git(repo, command)
- Dir.chdir(File.join(tmp_repos_path, repo)) { git_super(command).strip }
+ Dir.chdir(tmp_repos_path + repo) { git_super(command).strip }
end
def git_config(repo, attr)

0 comments on commit b64c0c1

Please sign in to comment.