summaryrefslogtreecommitdiff
path: root/spec/unit/puppet
diff options
context:
space:
mode:
Diffstat (limited to 'spec/unit/puppet')
-rw-r--r--spec/unit/puppet/provider/vcsrepo/bzr_spec.rb8
-rw-r--r--spec/unit/puppet/provider/vcsrepo/cvs_spec.rb4
-rw-r--r--spec/unit/puppet/provider/vcsrepo/git_spec.rb24
-rw-r--r--spec/unit/puppet/provider/vcsrepo/hg_spec.rb8
-rw-r--r--spec/unit/puppet/provider/vcsrepo/p4_spec.rb10
-rw-r--r--spec/unit/puppet/provider/vcsrepo/svn_spec.rb2
6 files changed, 28 insertions, 28 deletions
diff --git a/spec/unit/puppet/provider/vcsrepo/bzr_spec.rb b/spec/unit/puppet/provider/vcsrepo/bzr_spec.rb
index 488ddc0..b5e2f73 100644
--- a/spec/unit/puppet/provider/vcsrepo/bzr_spec.rb
+++ b/spec/unit/puppet/provider/vcsrepo/bzr_spec.rb
@@ -67,14 +67,14 @@ describe Puppet::Type.type(:vcsrepo).provider(:bzr_provider) do
it "should return the ref" do
resource[:revision] = '2634'
provider.expects(:bzr).with('revision-info', '2634').returns("2634 menesis@pov.lt-20100309191856-4wmfqzc803fj300x\n")
- provider.revision.should == resource.value(:revision)
+ expect(provider.revision).to eq(resource.value(:revision))
end
end
context "when its revid is different than the current revid" do
it "should return the current revid" do
resource[:revision] = '2636'
provider.expects(:bzr).with('revision-info', resource.value(:revision)).returns("2635 foo\n")
- provider.revision.should == @current_revid
+ expect(provider.revision).to eq(@current_revid)
end
end
end
@@ -84,14 +84,14 @@ describe Puppet::Type.type(:vcsrepo).provider(:bzr_provider) do
it "should return it" do
resource[:revision] = 'menesis@pov.lt-20100309191856-4wmfqzc803fj300x'
provider.expects(:bzr).with('revision-info', resource.value(:revision)).returns("1234 #{resource.value(:revision)}\n")
- provider.revision.should == resource.value(:revision)
+ expect(provider.revision).to eq(resource.value(:revision))
end
end
context "when it is not the same as the current revid" do
it "should return the current revid" do
resource[:revision] = 'menesis@pov.lt-20100309191856-4wmfqzc803fj300y'
provider.expects(:bzr).with('revision-info', resource.value(:revision)).returns("2636 foo\n")
- provider.revision.should == @current_revid
+ expect(provider.revision).to eq(@current_revid)
end
end
diff --git a/spec/unit/puppet/provider/vcsrepo/cvs_spec.rb b/spec/unit/puppet/provider/vcsrepo/cvs_spec.rb
index efa4b33..f5eebd9 100644
--- a/spec/unit/puppet/provider/vcsrepo/cvs_spec.rb
+++ b/spec/unit/puppet/provider/vcsrepo/cvs_spec.rb
@@ -86,7 +86,7 @@ describe Puppet::Type.type(:vcsrepo).provider(:cvs_provider) do
end
it "should read CVS/Tag" do
File.expects(:read).with(@tag_file).returns("T#{@tag}")
- provider.revision.should == @tag
+ expect(provider.revision).to eq(@tag)
end
end
@@ -95,7 +95,7 @@ describe Puppet::Type.type(:vcsrepo).provider(:cvs_provider) do
File.expects(:exist?).with(@tag_file).returns(false)
end
it "assumes HEAD" do
- provider.revision.should == 'HEAD'
+ expect(provider.revision).to eq('HEAD')
end
end
end
diff --git a/spec/unit/puppet/provider/vcsrepo/git_spec.rb b/spec/unit/puppet/provider/vcsrepo/git_spec.rb
index 3f81cc8..122eb62 100644
--- a/spec/unit/puppet/provider/vcsrepo/git_spec.rb
+++ b/spec/unit/puppet/provider/vcsrepo/git_spec.rb
@@ -134,7 +134,7 @@ branches
it "should raise an exception" do
provider.expects(:path_exists?).returns(true)
provider.expects(:path_empty?).returns(false)
- proc { provider.create }.should raise_error(Puppet::Error)
+ expect { provider.create }.to raise_error(Puppet::Error)
end
end
end
@@ -204,7 +204,7 @@ branches
provider.expects(:path_exists?).returns(true)
provider.expects(:path_empty?).returns(false)
provider.expects(:working_copy_exists?).returns(false)
- proc { provider.create }.should raise_error(Puppet::Error)
+ expect { provider.create }.to raise_error(Puppet::Error)
end
end
end
@@ -233,14 +233,14 @@ branches
context "when its SHA is not different than the current SHA" do
it "should return the ref" do
provider.expects(:git).with('rev-parse', resource.value(:revision)).returns('currentsha')
- provider.revision.should == resource.value(:revision)
+ expect(provider.revision).to eq(resource.value(:revision))
end
end
context "when its SHA is different than the current SHA" do
it "should return the current SHA" do
provider.expects(:git).with('rev-parse', resource.value(:revision)).returns('othersha')
- provider.revision.should == resource.value(:revision)
+ expect(provider.revision).to eq(resource.value(:revision))
end
end
@@ -248,7 +248,7 @@ branches
it "should return the revision" do
provider.stubs(:git).with('branch', '-a').returns(" remotes/origin/#{resource.value(:revision)}")
provider.expects(:git).with('rev-parse', "origin/#{resource.value(:revision)}").returns("newsha")
- provider.revision.should == resource.value(:revision)
+ expect(provider.revision).to eq(resource.value(:revision))
end
end
@@ -267,7 +267,7 @@ branches
provider.expects(:git).with('config', 'remote.origin.url').returns('old')
provider.expects(:git).with('config', 'remote.origin.url', 'git://git@foo.com/bar.git')
provider.expects(:git).with('rev-parse', resource.value(:revision)).returns('currentsha')
- provider.revision.should == resource.value(:revision)
+ expect(provider.revision).to eq(resource.value(:revision))
end
end
end
@@ -329,13 +329,13 @@ branches
context "when it's listed in 'git branch -a'" do
it "should return true" do
resource[:revision] = 'feature/foo'
- provider.should be_local_branch_revision
+ expect(provider).to be_local_branch_revision
end
end
context "when it's not listed in 'git branch -a'" do
it "should return false" do
resource[:revision] = 'feature/notexist'
- provider.should_not be_local_branch_revision
+ expect(provider).not_to be_local_branch_revision
end
end
end
@@ -343,13 +343,13 @@ branches
context "when it's listed in 'git branch -a' with an 'origin/' prefix" do
it "should return true" do
resource[:revision] = 'only/remote'
- provider.should be_remote_branch_revision
+ expect(provider).to be_remote_branch_revision
end
end
context "when it's not listed in 'git branch -a' with an 'origin/' prefix" do
it "should return false" do
resource[:revision] = 'only/local'
- provider.should_not be_remote_branch_revision
+ expect(provider).not_to be_remote_branch_revision
end
end
end
@@ -360,14 +360,14 @@ branches
it do
provider.expects(:revision).returns('testrev')
provider.expects(:latest_revision).returns('testrev')
- provider.latest?.should be_true
+ expect(provider.latest?).to be_truthy
end
end
context 'when false' do
it do
provider.expects(:revision).returns('master')
provider.expects(:latest_revision).returns('testrev')
- provider.latest?.should be_false
+ expect(provider.latest?).to be_falsey
end
end
end
diff --git a/spec/unit/puppet/provider/vcsrepo/hg_spec.rb b/spec/unit/puppet/provider/vcsrepo/hg_spec.rb
index 6b21c1c..65d820d 100644
--- a/spec/unit/puppet/provider/vcsrepo/hg_spec.rb
+++ b/spec/unit/puppet/provider/vcsrepo/hg_spec.rb
@@ -88,14 +88,14 @@ describe Puppet::Type.type(:vcsrepo).provider(:hg) do
context "when its SHA is not different than the current SHA" do
it "should return the ref" do
resource[:revision] = '0.6'
- provider.revision.should == '0.6'
+ expect(provider.revision).to eq('0.6')
end
end
context "when its SHA is different than the current SHA" do
it "should return the current SHA" do
resource[:revision] = '0.5.3'
- provider.revision.should == '34e6012c783a'
+ expect(provider.revision).to eq('34e6012c783a')
end
end
end
@@ -108,7 +108,7 @@ describe Puppet::Type.type(:vcsrepo).provider(:hg) do
it "should return it" do
resource[:revision] = '34e6012c783a'
provider.expects(:hg).with('tags').returns(fixture(:hg_tags))
- provider.revision.should == resource.value(:revision)
+ expect(provider.revision).to eq(resource.value(:revision))
end
end
@@ -116,7 +116,7 @@ describe Puppet::Type.type(:vcsrepo).provider(:hg) do
it "should return the current SHA" do
resource[:revision] = 'not-the-same'
provider.expects(:hg).with('tags').returns(fixture(:hg_tags))
- provider.revision.should == '34e6012c783a'
+ expect(provider.revision).to eq('34e6012c783a')
end
end
end
diff --git a/spec/unit/puppet/provider/vcsrepo/p4_spec.rb b/spec/unit/puppet/provider/vcsrepo/p4_spec.rb
index abbd9ec..e331cae 100644
--- a/spec/unit/puppet/provider/vcsrepo/p4_spec.rb
+++ b/spec/unit/puppet/provider/vcsrepo/p4_spec.rb
@@ -26,7 +26,7 @@ describe Puppet::Type.type(:vcsrepo).provider(:p4) do
resource[:source] = 'something'
resource[:revision] = '1'
ENV['P4CLIENT'] = 'client_ws1'
-
+
provider.expects(:p4).with(['client', '-o', 'client_ws1']).returns({})
provider.expects(:p4).with(['client', '-i'], spec)
provider.expects(:p4).with(['sync', resource.value(:source) + "@" + resource.value(:revision)])
@@ -38,7 +38,7 @@ describe Puppet::Type.type(:vcsrepo).provider(:p4) do
it "should just execute 'p4 sync' without a revision" do
resource[:source] = 'something'
ENV['P4CLIENT'] = 'client_ws2'
-
+
provider.expects(:p4).with(['client', '-o', 'client_ws2']).returns({})
provider.expects(:p4).with(['client', '-i'], spec)
provider.expects(:p4).with(['sync', resource.value(:source)])
@@ -49,11 +49,11 @@ describe Puppet::Type.type(:vcsrepo).provider(:p4) do
context "when a client and source are not given" do
it "should execute 'p4 client'" do
ENV['P4CLIENT'] = nil
-
+
path = resource.value(:path)
host = Facter.value('hostname')
default = "puppet-" + Digest::MD5.hexdigest(path + host)
-
+
provider.expects(:p4).with(['client', '-o', default]).returns({})
provider.expects(:p4).with(['client', '-i'], spec)
provider.create
@@ -64,7 +64,7 @@ describe Puppet::Type.type(:vcsrepo).provider(:p4) do
describe 'destroying' do
it "it should remove the directory" do
ENV['P4CLIENT'] = 'test_client'
-
+
provider.expects(:p4).with(['client', '-d', '-f', 'test_client'])
expects_rm_rf
provider.destroy
diff --git a/spec/unit/puppet/provider/vcsrepo/svn_spec.rb b/spec/unit/puppet/provider/vcsrepo/svn_spec.rb
index f44e314..494da52 100644
--- a/spec/unit/puppet/provider/vcsrepo/svn_spec.rb
+++ b/spec/unit/puppet/provider/vcsrepo/svn_spec.rb
@@ -75,7 +75,7 @@ describe Puppet::Type.type(:vcsrepo).provider(:svn) do
end
it "should use 'svn info'" do
expects_chdir
- provider.revision.should == '4' # From 'Revision', not 'Last Changed Rev'
+ expect(provider.revision).to eq('4') # From 'Revision', not 'Last Changed Rev'
end
end