Skip to content

Commit

Permalink
Added tests for specific tag and branch
Browse files Browse the repository at this point in the history
  • Loading branch information
Esteban committed Apr 13, 2014
1 parent 989e377 commit ab16bb1
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions spec/mercurial_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,21 @@ module Downloader
downloader.download
tmp_folder_with_quotes('README').read.strip.should == 'second commit'
end

it "checks out a specific tag" do
options = { :hg => fixture('mercurial-repo'), :tag => '1.0.0' }
downloader = Downloader.for_target(tmp_folder_with_quotes, options)
downloader.download
tmp_folder_with_quotes('README').read.strip.should == 'third commit'
end

it "checks out the branch head revision" do
options = { :hg => fixture('mercurial-repo'), :branch => 'feature/feature-branch' }
downloader = Downloader.for_target(tmp_folder_with_quotes, options)
downloader.download
tmp_folder_with_quotes('README').read.strip.should == 'fourth commit'
end

end

it "returns the checked out revision" do
Expand All @@ -60,6 +75,27 @@ module Downloader
downloader = Downloader.for_target(tmp_folder, options)
lambda { downloader.download }.should.raise DownloaderError
end

it "checks out a specific tag" do
options = { :hg => fixture('mercurial-repo'), :tag => '1.0.0'}
downloader = Downloader.for_target(tmp_folder, options)
downloader.download
downloader.checkout_options.should == {
:hg => fixture('mercurial-repo'),
:revision => '3c8b8d211b03c7e686049a8558e4c297104291eb'
}
end

it "checks out a specific branch head" do
options = { :hg => fixture('mercurial-repo'), :branch => 'feature/feature-branch'}
downloader = Downloader.for_target(tmp_folder, options)
downloader.download
downloader.checkout_options.should == {
:hg => fixture('mercurial-repo'),
:revision => '61118fa8988c2b2eae826f48abd1e3340dae0c6b'
}
end

end
end
end

0 comments on commit ab16bb1

Please sign in to comment.