Commit e5996e10 authored by Ben Asher's avatar Ben Asher

Fixed tests and rubocop issue

parent 3f68c358
...@@ -218,7 +218,7 @@ module Pod ...@@ -218,7 +218,7 @@ module Pod
# @return result of calling the git! with args in repo_dir # @return result of calling the git! with args in repo_dir
# #
def repo_git(*args) def repo_git(*args)
git!(["-C", repo_dir] + args) git!(['-C', repo_dir] + args)
end end
# @return [Pathname] The directory of the repository. # @return [Pathname] The directory of the repository.
......
...@@ -91,7 +91,7 @@ module Pod ...@@ -91,7 +91,7 @@ module Pod
set_up_test_repo_for_update set_up_test_repo_for_update
@sources_manager.expects(:update_search_index_if_needed_in_background).with({}).returns(nil) @sources_manager.expects(:update_search_index_if_needed_in_background).with({}).returns(nil)
MasterSource.any_instance.expects(:git!).with do |options| MasterSource.any_instance.expects(:git!).with do |options|
options.join(' ').should.equal %W(-C #{test_repo_path} pull --ff-only).join(' ') options.join(' ') == %W(-C #{test_repo_path} pull --ff-only).join(' ')
end end
@sources_manager.update(test_repo_path.basename.to_s, true) @sources_manager.update(test_repo_path.basename.to_s, true)
end end
...@@ -108,10 +108,10 @@ module Pod ...@@ -108,10 +108,10 @@ module Pod
test_repo_path.join('.git', 'shallow').open('w') { |f| f << 'a' * 40 } test_repo_path.join('.git', 'shallow').open('w') { |f| f << 'a' * 40 }
@sources_manager.expects(:update_search_index_if_needed_in_background).with({}).returns(nil) @sources_manager.expects(:update_search_index_if_needed_in_background).with({}).returns(nil)
MasterSource.any_instance.expects(:git!).with do |options| MasterSource.any_instance.expects(:git!).with do |options|
options.join(' ').should.equal %W(-C #{test_repo_path} fetch --unshallow).join(' ') options.join(' ') == %W(-C #{test_repo_path} fetch --unshallow).join(' ')
end end
MasterSource.any_instance.expects(:git!).with do |options| MasterSource.any_instance.expects(:git!).with do |options|
options.join(' ').should.equal %W(-C #{test_repo_path} pull --ff-only).join(' ') options.join(' ') == %W(-C #{test_repo_path} pull --ff-only).join(' ')
end end
@sources_manager.update(test_repo_path.basename.to_s, true) @sources_manager.update(test_repo_path.basename.to_s, true)
...@@ -121,13 +121,13 @@ module Pod ...@@ -121,13 +121,13 @@ module Pod
it 'prints a warning if the update failed' do it 'prints a warning if the update failed' do
set_up_test_repo_for_update set_up_test_repo_for_update
Source.any_instance.stubs(:git).with do |options| Source.any_instance.stubs(:git).with do |options|
options.join(' ').should.equal %W(-C #{test_repo_path} rev-parse HEAD).join(' ') options.join(' ') == %W(-C #{test_repo_path} rev-parse HEAD).join(' ')
end.returns('aabbccd') end.returns('aabbccd')
Source.any_instance.stubs(:git).with do |options| Source.any_instance.stubs(:git).with do |options|
options.join(' ').should.equal %W(-C #{test_repo_path} diff --name-only aabbccd..HEAD).join(' ') options.join(' ') == %W(-C #{test_repo_path} diff --name-only aabbccd..HEAD).join(' ')
end.returns('') end.returns('')
MasterSource.any_instance.expects(:git!).with do |options| MasterSource.any_instance.expects(:git!).with do |options|
options.join(' ').should.equal %W(-C #{test_repo_path} pull --ff-only).join(' ') options.join(' ') == %W(-C #{test_repo_path} pull --ff-only).join(' ')
end.raises(<<-EOS) end.raises(<<-EOS)
fatal: '/dev/null' does not appear to be a git repository fatal: '/dev/null' does not appear to be a git repository
fatal: Could not read from remote repository. fatal: Could not read from remote repository.
......
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