3 describe_provider :vcsrepo, :bzr, :resource => {:path => '/tmp/vcsrepo'} do
6 resource_with :source do
7 resource_with :revision do
8 it "should execute 'bzr clone -r' with the revision" do
9 provider.expects(:bzr).with('branch', '-r', resource.value(:revision), resource.value(:source), resource.value(:path))
13 resource_without :revision do
14 it "should just execute 'bzr clone' without a revision" do
15 provider.expects(:bzr).with('branch', resource.value(:source), resource.value(:path))
20 resource_without :source do
21 it "should execute 'bzr init'" do
22 provider.expects(:bzr).with('init', resource.value(:path))
28 describe 'destroying' do
29 it "it should remove the directory" do
35 describe "checking existence" do
36 it "should check for the directory" do
37 expects_directory?(true, File.join(resource.value(:path), '.bzr'))
42 describe "checking the revision property" do
45 provider.expects(:bzr).with('version-info').returns(fixture(:bzr_version_info))
46 @current_revid = 'menesis@pov.lt-20100309191856-4wmfqzc803fj300x'
48 context "when given a non-revid as the resource revision", :resource => {:revision => '2634'} do
49 context "when its revid is not different than the current revid" do
51 provider.expects(:bzr).with('revision-info', resource.value(:revision)).returns("#{resource.value(:revision)} menesis@pov.lt-20100309191856-4wmfqzc803fj300x\n")
53 it "should return the ref" do
54 provider.revision.should == resource.value(:revision)
57 context "when its revid is different than the current revid", :resource => {:revision => '2636'} do
58 it "should return the current revid" do
59 provider.expects(:bzr).with('revision-info', resource.value(:revision)).returns("2635 foo\n")
60 provider.revision.should == @current_revid
64 context "when given a revid as the resource revision" do
65 context "when it is the same as the current revid", :resource => {:revision => 'menesis@pov.lt-20100309191856-4wmfqzc803fj300x'} do
67 provider.expects(:bzr).with('revision-info', resource.value(:revision)).returns("1234 #{resource.value(:revision)}\n")
69 it "should return it" do
70 provider.revision.should == resource.value(:revision)
73 context "when it is not the same as the current revid", :resource => {:revision => 'menesis@pov.lt-20100309191856-4wmfqzc803fj300y'} do
74 it "should return the current revid" do
75 provider.expects(:bzr).with('revision-info', resource.value(:revision)).returns("2636 foo\n")
76 provider.revision.should == @current_revid
82 describe "setting the revision property" do
83 it "should use 'bzr update -r' with the revision" do
85 provider.expects('bzr').with('update', '-r', revision, resource.value(:path))
86 provider.revision = revision