Sha256: c90f6a940a90c33499bd929170b6d0fb73ccc54e1f89e6aa51e3ea7c2127b95c

Contents?: true

Size: 1.46 KB

Versions: 5

Compression:

Stored size: 1.46 KB

Contents

require 'spec_helper'
require 'rake_context'

require 'rubygems/tasks/scm/tag'

describe Gem::Tasks::SCM::Tag do
  let(:version) { '1.2.3' }

  describe "#version_tag" do
    context "defaults" do
      include_context "rake"

      it "should not have a prefix or suffix" do
        subject.version_tag(version).should == version
      end
    end

    context "with format String" do
      include_context "rake"

      let(:format) { 'v%s' }

      subject { described_class.new(:format => format) }

      it "should apply the format String to the version" do
        subject.version_tag(version).should == "v#{version}"
      end
    end

    context "with format Proc" do
      let(:format) { proc { |ver| "REL_" + ver.tr('.','_') } }

      subject { described_class.new(:format => format) }

      it "should call the format Proc with the version" do
        subject.version_tag(version).should == "REL_1_2_3"
      end
    end
  end

  describe "#tag!" do
    let(:name) { 'v1.2.3' }

    context "git" do
      include_context "rake"

      it "should run `git tag`" do
        subject.project.stub!(:scm).and_return(:git)
        subject.should_receive(:run).with('git', 'tag', name)

        subject.tag!(name)
      end
    end

    context "hg" do
      include_context "rake"

      it "should run `hg tag`" do
        subject.project.stub!(:scm).and_return(:hg)
        subject.should_receive(:run).with('hg', 'tag', name)

        subject.tag!(name)
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rubygems-tasks-0.1.2 spec/scm/tag_spec.rb
rubygems-tasks-0.1.1 spec/scm/tag_spec.rb
rubygems-tasks-0.1.0 spec/scm/tag_spec.rb
rubygems-tasks-0.1.0.pre3 spec/scm/tag_spec.rb
rubygems-tasks-0.1.0.pre2 spec/scm/tag_spec.rb