Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added specs for Gem::Tasks::SCM::Tag#version_tag.
- Loading branch information
1 parent
e77d163
commit 93ca97c
Showing
1 changed file
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
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 "default" 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 | ||
include_context "rake" | ||
|
||
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 | ||
end |