summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorRaphaël Pinson <raphael.pinson@camptocamp.com>2014-12-09 15:43:05 +0100
committerRaphaël Pinson <raphael.pinson@camptocamp.com>2014-12-09 15:43:05 +0100
commit1d1bab299473365788deef074e50167c1e082c0f (patch)
treeb082c89a824e1e87f619827baf07260dd6dd4963 /spec
parent2ab024ab14bdf831233d727f55d0a3cc0cf5e5b3 (diff)
Convert specs to rspec3 syntax
Diffstat (limited to 'spec')
-rw-r--r--spec/defines/augeas_lens_spec.rb26
-rw-r--r--spec/hosts/simple_debian_squeeze_spec.rb28
-rw-r--r--spec/hosts/simple_debian_wheezy_spec.rb28
-rw-r--r--spec/hosts/simple_redhat_spec.rb24
-rw-r--r--spec/hosts/with_lens_noaugeas_spec.rb2
-rw-r--r--spec/hosts/with_lens_spec.rb24
-rw-r--r--spec/hosts/wrong_os_spec.rb2
-rw-r--r--spec/unit/puppet/parser/functions/augeas_spec.rb6
8 files changed, 70 insertions, 70 deletions
diff --git a/spec/defines/augeas_lens_spec.rb b/spec/defines/augeas_lens_spec.rb
index cd9d515..5318d8d 100644
--- a/spec/defines/augeas_lens_spec.rb
+++ b/spec/defines/augeas_lens_spec.rb
@@ -12,7 +12,7 @@ describe 'augeas::lens' do
context 'when no lens_source is passed' do
it 'should error' do
expect {
- should contain_file('/usr/share/augeas/lenses/foo.aug')
+ is_expected.to contain_file('/usr/share/augeas/lenses/foo.aug')
}.to raise_error(Puppet::Error, /Must pass lens_source/)
end
end
@@ -22,10 +22,10 @@ describe 'augeas::lens' do
:lens_source => '/tmp/foo.aug',
} }
- it { should contain_file('/usr/share/augeas/lenses/foo.aug') }
- it { should contain_exec('Typecheck lens foo') }
- it { should_not contain_file('/usr/share/augeas/lenses/tests/test_foo.aug') }
- it { should_not contain_exec('Test lens foo') }
+ it { is_expected.to contain_file('/usr/share/augeas/lenses/foo.aug') }
+ it { is_expected.to contain_exec('Typecheck lens foo') }
+ it { is_expected.not_to contain_file('/usr/share/augeas/lenses/tests/test_foo.aug') }
+ it { is_expected.not_to contain_exec('Test lens foo') }
end
context 'when lens_source and test_source are passed' do
@@ -34,10 +34,10 @@ describe 'augeas::lens' do
:test_source => '/tmp/test_foo.aug',
} }
- it { should contain_file('/usr/share/augeas/lenses/foo.aug') }
- it { should contain_exec('Typecheck lens foo') }
- it { should contain_file('/usr/share/augeas/lenses/tests/test_foo.aug') }
- it { should contain_exec('Test lens foo') }
+ it { is_expected.to contain_file('/usr/share/augeas/lenses/foo.aug') }
+ it { is_expected.to contain_exec('Typecheck lens foo') }
+ it { is_expected.to contain_file('/usr/share/augeas/lenses/tests/test_foo.aug') }
+ it { is_expected.to contain_exec('Test lens foo') }
end
context 'when stock_since is passed and augeas is older' do
@@ -55,8 +55,8 @@ describe 'augeas::lens' do
:path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
} }
- it { should contain_file('/usr/share/augeas/lenses/foo.aug') }
- it { should contain_exec('Typecheck lens foo') }
+ it { is_expected.to contain_file('/usr/share/augeas/lenses/foo.aug') }
+ it { is_expected.to contain_exec('Typecheck lens foo') }
end
context 'when stock_since is passed and augeas is newer' do
@@ -74,7 +74,7 @@ describe 'augeas::lens' do
:path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
} }
- it { should_not contain_file('/usr/share/augeas/lenses/foo.aug') }
- it { should_not contain_exec('Typecheck lens foo') }
+ it { is_expected.not_to contain_file('/usr/share/augeas/lenses/foo.aug') }
+ it { is_expected.not_to contain_exec('Typecheck lens foo') }
end
end
diff --git a/spec/hosts/simple_debian_squeeze_spec.rb b/spec/hosts/simple_debian_squeeze_spec.rb
index 08ecd3e..18bc50c 100644
--- a/spec/hosts/simple_debian_squeeze_spec.rb
+++ b/spec/hosts/simple_debian_squeeze_spec.rb
@@ -19,16 +19,16 @@ describe 'simple_debian_squeeze' do
:rubyversion => '1.8.7',
} }
- it { should contain_package('libaugeas0').with(
+ it { is_expected.to contain_package('libaugeas0').with(
:ensure => 'present'
) }
- it { should contain_package('augeas-tools').with(
+ it { is_expected.to contain_package('augeas-tools').with(
:ensure => 'present'
) }
- it { should contain_package('augeas-lenses').with(
+ it { is_expected.to contain_package('augeas-lenses').with(
:ensure => 'present'
) }
- it { should contain_package('ruby-augeas').with(
+ it { is_expected.to contain_package('ruby-augeas').with(
:ensure => 'present',
:name => 'libaugeas-ruby1.8'
) }
@@ -44,16 +44,16 @@ describe 'simple_debian_squeeze' do
:rubyversion => '1.8.7',
} }
- it { should contain_package('libaugeas0').with(
+ it { is_expected.to contain_package('libaugeas0').with(
:ensure => '1.2.3'
) }
- it { should contain_package('augeas-tools').with(
+ it { is_expected.to contain_package('augeas-tools').with(
:ensure => '1.2.3'
) }
- it { should contain_package('augeas-lenses').with(
+ it { is_expected.to contain_package('augeas-lenses').with(
:ensure => '1.2.3'
) }
- it { should contain_package('ruby-augeas').with(
+ it { is_expected.to contain_package('ruby-augeas').with(
:ensure => '3.2.1',
:name => 'libaugeas-ruby1.8'
) }
@@ -69,18 +69,18 @@ describe 'simple_debian_squeeze' do
:rubyversion => '1.8.7',
} }
- it { should contain_file('/usr/share/augeas/lenses').with(
+ it { is_expected.to contain_file('/usr/share/augeas/lenses').with(
:ensure => 'directory',
:purge => 'true',
:force => 'true',
:recurse => 'true',
:recurselimit => 1
) }
- it { should contain_file('/usr/share/augeas/lenses/dist').with(
+ it { is_expected.to contain_file('/usr/share/augeas/lenses/dist').with(
:ensure => 'directory',
:purge => 'false'
) }
- it { should contain_file('/usr/share/augeas/lenses/tests').with(
+ it { is_expected.to contain_file('/usr/share/augeas/lenses/tests').with(
:ensure => 'directory',
:purge => 'true',
:force => 'true'
@@ -97,18 +97,18 @@ describe 'simple_debian_squeeze' do
:rubyversion => '1.8.7',
} }
- it { should contain_file('/opt/augeas/lenses').with(
+ it { is_expected.to contain_file('/opt/augeas/lenses').with(
:ensure => 'directory',
:purge => 'true',
:force => 'true',
:recurse => 'true',
:recurselimit => 1
) }
- it { should contain_file('/opt/augeas/lenses/dist').with(
+ it { is_expected.to contain_file('/opt/augeas/lenses/dist').with(
:ensure => 'directory',
:purge => 'false'
) }
- it { should contain_file('/opt/augeas/lenses/tests').with(
+ it { is_expected.to contain_file('/opt/augeas/lenses/tests').with(
:ensure => 'directory',
:purge => 'true',
:force => 'true'
diff --git a/spec/hosts/simple_debian_wheezy_spec.rb b/spec/hosts/simple_debian_wheezy_spec.rb
index f301038..3e20db0 100644
--- a/spec/hosts/simple_debian_wheezy_spec.rb
+++ b/spec/hosts/simple_debian_wheezy_spec.rb
@@ -11,16 +11,16 @@ describe 'simple_debian_wheezy' do
} }
context 'when versions are not specified' do
- it { should contain_package('libaugeas0').with(
+ it { is_expected.to contain_package('libaugeas0').with(
:ensure => 'present'
) }
- it { should contain_package('augeas-tools').with(
+ it { is_expected.to contain_package('augeas-tools').with(
:ensure => 'present'
) }
- it { should contain_package('augeas-lenses').with(
+ it { is_expected.to contain_package('augeas-lenses').with(
:ensure => 'present'
) }
- it { should contain_package('ruby-augeas').with(
+ it { is_expected.to contain_package('ruby-augeas').with(
:ensure => 'present',
:name => 'libaugeas-ruby1.9.1'
) }
@@ -36,16 +36,16 @@ describe 'simple_debian_wheezy' do
:augeas_ruby_version => '3.2.1',
} }
- it { should contain_package('libaugeas0').with(
+ it { is_expected.to contain_package('libaugeas0').with(
:ensure => '1.2.3'
) }
- it { should contain_package('augeas-tools').with(
+ it { is_expected.to contain_package('augeas-tools').with(
:ensure => '1.2.3'
) }
- it { should contain_package('augeas-lenses').with(
+ it { is_expected.to contain_package('augeas-lenses').with(
:ensure => '1.2.3'
) }
- it { should contain_package('ruby-augeas').with(
+ it { is_expected.to contain_package('ruby-augeas').with(
:ensure => '3.2.1',
:name => 'libaugeas-ruby1.9.1'
) }
@@ -60,18 +60,18 @@ describe 'simple_debian_wheezy' do
:rubyversion => '1.9.1',
} }
- it { should contain_file('/usr/share/augeas/lenses').with(
+ it { is_expected.to contain_file('/usr/share/augeas/lenses').with(
:ensure => 'directory',
:purge => 'true',
:force => 'true',
:recurse => 'true',
:recurselimit => 1
) }
- it { should contain_file('/usr/share/augeas/lenses/dist').with(
+ it { is_expected.to contain_file('/usr/share/augeas/lenses/dist').with(
:ensure => 'directory',
:purge => 'false'
) }
- it { should contain_file('/usr/share/augeas/lenses/tests').with(
+ it { is_expected.to contain_file('/usr/share/augeas/lenses/tests').with(
:ensure => 'directory',
:purge => 'true',
:force => 'true'
@@ -88,18 +88,18 @@ describe 'simple_debian_wheezy' do
:rubyversion => '1.9.1',
} }
- it { should contain_file('/opt/augeas/lenses').with(
+ it { is_expected.to contain_file('/opt/augeas/lenses').with(
:ensure => 'directory',
:purge => 'true',
:force => 'true',
:recurse => 'true',
:recurselimit => 1
) }
- it { should contain_file('/opt/augeas/lenses/dist').with(
+ it { is_expected.to contain_file('/opt/augeas/lenses/dist').with(
:ensure => 'directory',
:purge => 'false'
) }
- it { should contain_file('/opt/augeas/lenses/tests').with(
+ it { is_expected.to contain_file('/opt/augeas/lenses/tests').with(
:ensure => 'directory',
:purge => 'true',
:force => 'true'
diff --git a/spec/hosts/simple_redhat_spec.rb b/spec/hosts/simple_redhat_spec.rb
index a7acd1f..42c17c8 100644
--- a/spec/hosts/simple_redhat_spec.rb
+++ b/spec/hosts/simple_redhat_spec.rb
@@ -13,13 +13,13 @@ describe 'simple_redhat' do
:osfamily => 'RedHat',
} }
- it { should contain_package('augeas').with(
+ it { is_expected.to contain_package('augeas').with(
:ensure => 'present'
) }
- it { should contain_package('augeas-libs').with(
+ it { is_expected.to contain_package('augeas-libs').with(
:ensure => 'present'
) }
- it { should contain_package('ruby-augeas').with(
+ it { is_expected.to contain_package('ruby-augeas').with(
:ensure => 'present',
:name => 'ruby-augeas'
) }
@@ -33,13 +33,13 @@ describe 'simple_redhat' do
:augeas_ruby_version => '3.2.1',
} }
- it { should contain_package('augeas').with(
+ it { is_expected.to contain_package('augeas').with(
:ensure => '1.2.3'
) }
- it { should contain_package('augeas-libs').with(
+ it { is_expected.to contain_package('augeas-libs').with(
:ensure => '1.2.3'
) }
- it { should contain_package('ruby-augeas').with(
+ it { is_expected.to contain_package('ruby-augeas').with(
:ensure => '3.2.1',
:name => 'ruby-augeas'
) }
@@ -53,18 +53,18 @@ describe 'simple_redhat' do
:osfamily => 'RedHat',
} }
- it { should contain_file('/usr/share/augeas/lenses').with(
+ it { is_expected.to contain_file('/usr/share/augeas/lenses').with(
:ensure => 'directory',
:purge => 'true',
:force => 'true',
:recurse => 'true',
:recurselimit => 1
) }
- it { should contain_file('/usr/share/augeas/lenses/dist').with(
+ it { is_expected.to contain_file('/usr/share/augeas/lenses/dist').with(
:ensure => 'directory',
:purge => 'false'
) }
- it { should contain_file('/usr/share/augeas/lenses/tests').with(
+ it { is_expected.to contain_file('/usr/share/augeas/lenses/tests').with(
:ensure => 'directory',
:purge => 'true',
:force => 'true'
@@ -79,18 +79,18 @@ describe 'simple_redhat' do
:osfamily => 'RedHat',
} }
- it { should contain_file('/opt/augeas/lenses').with(
+ it { is_expected.to contain_file('/opt/augeas/lenses').with(
:ensure => 'directory',
:purge => 'true',
:force => 'true',
:recurse => 'true',
:recurselimit => 1
) }
- it { should contain_file('/opt/augeas/lenses/dist').with(
+ it { is_expected.to contain_file('/opt/augeas/lenses/dist').with(
:ensure => 'directory',
:purge => 'false'
) }
- it { should contain_file('/opt/augeas/lenses/tests').with(
+ it { is_expected.to contain_file('/opt/augeas/lenses/tests').with(
:ensure => 'directory',
:purge => 'true',
:force => 'true'
diff --git a/spec/hosts/with_lens_noaugeas_spec.rb b/spec/hosts/with_lens_noaugeas_spec.rb
index b26563b..7786918 100644
--- a/spec/hosts/with_lens_noaugeas_spec.rb
+++ b/spec/hosts/with_lens_noaugeas_spec.rb
@@ -3,7 +3,7 @@ require 'spec_helper'
describe 'with_lens_noaugeas' do
it 'should error' do
expect {
- should contain_file('/usr/share/augeas/lenses/foo.aug')
+ is_expected.to contain_file('/usr/share/augeas/lenses/foo.aug')
}.to raise_error(Puppet::Error, /You must declare the augeas class/)
end
end
diff --git a/spec/hosts/with_lens_spec.rb b/spec/hosts/with_lens_spec.rb
index 10437c9..e0f5dff 100644
--- a/spec/hosts/with_lens_spec.rb
+++ b/spec/hosts/with_lens_spec.rb
@@ -15,10 +15,10 @@ describe 'with_lens' do
:path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
} }
- it { should contain_file('/usr/share/augeas/lenses/foo.aug') }
- it { should contain_exec('Typecheck lens foo') }
- it { should_not contain_file('/usr/share/augeas/lenses/tests/test_foo.aug') }
- it { should_not contain_exec('Test lens foo') }
+ it { is_expected.to contain_file('/usr/share/augeas/lenses/foo.aug') }
+ it { is_expected.to contain_exec('Typecheck lens foo') }
+ it { is_expected.not_to contain_file('/usr/share/augeas/lenses/tests/test_foo.aug') }
+ it { is_expected.not_to contain_exec('Test lens foo') }
end
context 'when lens_source and test_source are passed' do
@@ -30,10 +30,10 @@ describe 'with_lens' do
:path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
} }
- it { should contain_file('/usr/share/augeas/lenses/foo.aug') }
- it { should contain_exec('Typecheck lens foo') }
- it { should contain_file('/usr/share/augeas/lenses/tests/test_foo.aug') }
- it { should contain_exec('Test lens foo') }
+ it { is_expected.to contain_file('/usr/share/augeas/lenses/foo.aug') }
+ it { is_expected.to contain_exec('Typecheck lens foo') }
+ it { is_expected.to contain_file('/usr/share/augeas/lenses/tests/test_foo.aug') }
+ it { is_expected.to contain_exec('Test lens foo') }
end
context 'when stock_since is passed and augeas is older' do
@@ -46,8 +46,8 @@ describe 'with_lens' do
:path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
} }
- it { should contain_file('/usr/share/augeas/lenses/foo.aug') }
- it { should contain_exec('Typecheck lens foo') }
+ it { is_expected.to contain_file('/usr/share/augeas/lenses/foo.aug') }
+ it { is_expected.to contain_exec('Typecheck lens foo') }
end
context 'when stock_since is passed and augeas is newer' do
@@ -60,7 +60,7 @@ describe 'with_lens' do
:path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
} }
- it { should_not contain_file('/usr/share/augeas/lenses/foo.aug') }
- it { should_not contain_exec('Typecheck lens foo') }
+ it { is_expected.not_to contain_file('/usr/share/augeas/lenses/foo.aug') }
+ it { is_expected.not_to contain_exec('Typecheck lens foo') }
end
end
diff --git a/spec/hosts/wrong_os_spec.rb b/spec/hosts/wrong_os_spec.rb
index 4180e81..98fb93f 100644
--- a/spec/hosts/wrong_os_spec.rb
+++ b/spec/hosts/wrong_os_spec.rb
@@ -10,6 +10,6 @@ describe 'wrong_os' do
} }
it 'should fail' do
- expect { should contain_package('ruby-augeas') }.to raise_error(Puppet::Error, /Unsupported OS family/)
+ expect { is_expected.to contain_package('ruby-augeas') }.to raise_error(Puppet::Error, /Unsupported OS family/)
end
end
diff --git a/spec/unit/puppet/parser/functions/augeas_spec.rb b/spec/unit/puppet/parser/functions/augeas_spec.rb
index 9c48773..b34fa5b 100644
--- a/spec/unit/puppet/parser/functions/augeas_spec.rb
+++ b/spec/unit/puppet/parser/functions/augeas_spec.rb
@@ -10,7 +10,7 @@ describe 'the augeas function' do
end
it "should exist" do
- Puppet::Parser::Functions.function("augeas").should == "function_augeas"
+ expect(Puppet::Parser::Functions.function("augeas")).to eq("function_augeas")
end
context "when passing wrong arguments" do
@@ -57,13 +57,13 @@ describe 'the augeas function' do
context "when applying valid changes" do
it "should remove the 3rd option" do
result = scope.function_augeas(["proc /proc proc nodev,noexec,nosuid 0 0\n", 'Fstab.lns', ['rm ./1/opt[3]']])
- result.class.should == String
+ expect(result.class).to eq(String)
#result.should == "proc /proc proc nodev,noexec 0 0\n"
end
it "should set a 4th option" do
result = scope.function_augeas(["proc /proc proc nodev,noexec,nosuid 0 0\n", 'Fstab.lns', ['ins opt after ./1/opt[last()]', 'set ./1/opt[last()] nofoo']])
- result.class.should == String
+ expect(result.class).to eq(String)
#result.should == "proc /proc proc nodev,noexec,nosuid,nofoo 0 0\n"
end
end