Sha256: b35eaf4954810d56480f87257e4ed205fad08b3c500b50f9b8025b2ae9fb840d

Contents?: true

Size: 1.8 KB

Versions: 1

Compression:

Stored size: 1.8 KB

Contents

require File.dirname(__FILE__) + '/spec_helper.rb'

describe "Braid::Operations::Mirror#find_remote" do
  include Braid::Operations::Mirror

  before(:each) do
    File.should_receive(:readlines).and_return(["[remote \"braid/git/one\"]\n", "[svn-remote \"braid/git/two\"]\n"])
  end

  it "should return true for existing git remotes" do
    find_remote("braid/git/one").should == true
  end

  it "should return true for existing svn remotes" do
    find_remote("braid/git/two").should == true
  end

  it "should return false for nonexistent remotes" do
    find_remote("N/A").should == false
  end
end

describe Braid::Operations::Helpers, "extract_version" do
  it "should extract from git --version output" do
    self.stub!(:exec!).and_return([0, "git version 1.5.5.1.98.gf0ec4\n", ""])
    extract_version("git").should == "1.5.5.1.98.gf0ec4"
  end
  it "should extract from git svn --version output" do
    self.stub!(:exec!).and_return([0, "git-svn version 1.5.5.1.98.gf0ec4\n", ""])
    extract_version("git svn").should == "1.5.5.1.98.gf0ec4"
  end
end

describe Braid::Operations::Helpers, "verify_version against 1.5.4.5" do
  required_version = "1.5.4.5"
  should_pass      = %w(1.5.4.6 1.5.5 1.6 1.5.4.5.2 1.5.5.1.98.gf0ec4)
  should_not_pass  = %w(1.5.4.4 1.5.4 1.5.3 1.4.5.6)

  should_pass.each do |actual_version|
    it "should be true for #{actual_version}" do
      self.should_receive(:extract_version).with("some git executable").and_return(actual_version)
      verify_version("some git executable", "1.5.4.5").should == true
    end
  end

  should_not_pass.each do |actual_version|
    it "should be false for #{actual_version}" do
      self.should_receive(:extract_version).with("some git executable").and_return(actual_version)
      verify_version("some git executable", "1.5.4.5").should == false
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
misaka-braid-0.4.0.1 spec/operations_spec.rb