summaryrefslogtreecommitdiff
path: root/spec/unit
diff options
context:
space:
mode:
authorIgor Galić <i.galic@brainsware.org>2014-09-29 19:19:21 +0200
committerIgor Galić <i.galic@brainsware.org>2014-09-29 19:19:21 +0200
commit1df5570580c1d429a8fed25033a19333fcaffbda (patch)
tree32b1c5aba427f3162d20e94efd8922ff884296d4 /spec/unit
parent38c9c20c5abb5a19917ee3af9e0b6f1f1e8a0b49 (diff)
Convert specs to RSpec 2.99.2 syntax with Transpec
This conversion is done by Transpec 2.3.7 with the following command: transpec * 22 conversions from: it { should ... } to: it { is_expected.to ... } * 19 conversions from: obj.should to: expect(obj).to * 15 conversions from: == expected to: eq(expected) * 5 conversions from: it { should_not ... } to: it { is_expected.not_to ... } * 2 conversions from: its(:attr) { } to: describe '#attr' do subject { super().attr }; it { } end * 2 conversions from: obj.should_not to: expect(obj).not_to * 2 conversions from: proc { }.should to: expect { }.to * 1 conversion from: be_false to: be_falsey * 1 conversion from: be_true to: be_truthy For more details: https://github.com/yujinakayama/transpec#supported-conversions
Diffstat (limited to 'spec/unit')
-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/svn_spec.rb2
5 files changed, 23 insertions, 23 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/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