Commit 01c86d92 authored by Boris Bügling's avatar Boris Bügling

Added specs for testing if git options are present

parent c16b69bb
require File.expand_path('../../spec_helper', __FILE__) require File.expand_path('../../spec_helper', __FILE__)
def set_up_test_repo_for_update
set_up_test_repo
upstream = SpecHelper.temporary_directory + 'upstream'
FileUtils.cp_r(test_repo_path, upstream)
Dir.chdir(test_repo_path) do
`git remote add origin #{upstream}`
`git remote -v`
`git fetch -q`
`git branch --set-upstream-to=origin/master master`
`git config branch.master.rebase true`
end
config.repos_dir = SpecHelper.tmp_repos_path
end
module Pod module Pod
describe SourcesManager do describe SourcesManager do
...@@ -87,22 +101,26 @@ module Pod ...@@ -87,22 +101,26 @@ module Pod
extend SpecHelper::TemporaryRepos extend SpecHelper::TemporaryRepos
it "update source backed by a git repository" do it "update source backed by a git repository" do
set_up_test_repo set_up_test_repo_for_update
upstream = SpecHelper.temporary_directory + 'upstream'
FileUtils.cp_r(test_repo_path, upstream)
Dir.chdir(test_repo_path) do
`git remote add origin #{upstream}`
`git remote -v`
`git fetch -q`
`git branch --set-upstream-to=origin/master master`
`git config branch.master.rebase true`
end
config.repos_dir = SpecHelper.tmp_repos_path
SourcesManager.update(test_repo_path.basename.to_s, true) SourcesManager.update(test_repo_path.basename.to_s, true)
UI.output.should.match /Already up-to-date/ UI.output.should.match /Already up-to-date/
end end
it "is robust against user settings for git repos" do
set_up_test_repo_for_update
SourcesManager.expects(:git!).with() { |options| options.should.match /--no-rebase/ }
SourcesManager.update(test_repo_path.basename.to_s, true)
end
it "doesn't allow merge commits" do
set_up_test_repo_for_update
SourcesManager.expects(:git!).with() { |options| options.should.match /--no-commit/ }
SourcesManager.update(test_repo_path.basename.to_s, true)
end
it 'returns whether a source has a reachable git remote' do it 'returns whether a source has a reachable git remote' do
SourcesManager.git_remote_reachable?(repo_make('a_new_repo_that_is_new')).should.be.false SourcesManager.git_remote_reachable?(repo_make('a_new_repo_that_is_new')).should.be.false
SourcesManager.git_remote_reachable?(SourcesManager.master_repo_dir).should.be.true SourcesManager.git_remote_reachable?(SourcesManager.master_repo_dir).should.be.true
......
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