Sha256: 2fc2565dbe78ce0089011aa209e22309cb6f74c37ef573bffdb28bd14e9fcb97

Contents?: true

Size: 1.97 KB

Versions: 1

Compression:

Stored size: 1.97 KB

Contents

require File.join(File.dirname(__FILE__), '..', '..', 'spec_helper')

describe Yad::Scm::Git do

  it "should build the default checkout command" do
    cmd = Yad::Scm::Git.build_checkout_command('ssh://some.domain.com/path/to/myapp.git', 'path/to/scm')
    cmd.should eql("([ -d path/to/scm/cached-copy/.git ] && echo 'Existing repository found' || git clone ssh://some.domain.com/path/to/myapp.git path/to/scm/cached-copy) && cd path/to/scm/cached-copy && git fetch && git reset --hard origin/master && git submodule -q init && git submodule -q update")
  end

  it "should build the checkout command with revision" do
    cmd = Yad::Scm::Git.build_checkout_command('ssh://some.domain.com/path/to/myapp.git', 'path/to/scm', :revision => 'origin/staging')
    cmd.should eql("([ -d path/to/scm/cached-copy/.git ] && echo 'Existing repository found' || git clone ssh://some.domain.com/path/to/myapp.git path/to/scm/cached-copy) && cd path/to/scm/cached-copy && git fetch && git reset --hard origin/staging && git submodule -q init && git submodule -q update")
  end
  
  it "should build the checkout command without submodules" do
    cmd = Yad::Scm::Git.build_checkout_command('ssh://some.domain.com/path/to/myapp.git',  'path/to/scm', :enable_submodules => false)
    cmd.should eql("([ -d path/to/scm/cached-copy/.git ] && echo 'Existing repository found' || git clone ssh://some.domain.com/path/to/myapp.git path/to/scm/cached-copy) && cd path/to/scm/cached-copy && git fetch && git reset --hard origin/master")
  end
  
  it "should build the export command" do
    cmd = Yad::Scm::Git.build_export_command('path/to/source', 'path/to/destination')
    cmd.should eql("mkdir -p path/to/destination && rsync -a -f '- .git' path/to/source/cached-copy/ path/to/destination")
  end

  it "should build the inline revision identifier command" do
    cmd = Yad::Scm::Git.build_inline_revision_identifier_command('path/to/scm')
    cmd.should eql("`cd path/to/scm/cached-copy && git rev-parse origin/master`")
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
yad-0.0.4 spec/yad/scm/git_spec.rb