Sha256: adabf9545ed0d5a0ac16c8aa78d7a44dd75d6017dd20ac489dd2e64a2121275c

Contents?: true

Size: 1.23 KB

Versions: 1

Compression:

Stored size: 1.23 KB

Contents

require 'spec_helper'

describe Gitme do

  let(:name) do
    'something'
  end

  let(:repository) do
    File.join(File.dirname(__FILE__),'..','.git')
  end

  describe "#initialize" do
    it "should not generate an error" do
      lambda{ described_class.new({}) }.should_not raise_error
    end
  end

  describe "#execute!" do

    subject do
      described_class.new({:repository => repository})
    end

    it "should call #clone for the specified repository" do
      mock(subject).clone
      subject.execute!
    end

  end

  describe "#clone" do

    describe "a simple repository" do

      subject do
        described_class.new({:repository => repository, :name => name})
      end

      it "should clone the specified repository" do
        subject.clone
        File.exists?(name).should be_true
      end

      after do
        FileUtils.rm_rf(name) if File.exists?(name)
      end

    end

    describe "when git fails" do

      subject do
        described_class.new({:repository => 'non_existent_repo', :name => name})
      end

      it "should clone the specified repository" do
        lambda{ subject.clone }.should raise_error(Gitme::Error,
          "Git failed to clone non_existent_repo")
      end

    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gitme-0.0.1 spec/gitme_spec.rb