From 4775718a2f25dbeb1f581aba04376bcf2fa276f2 Mon Sep 17 00:00:00 2001 From: Alex Harvey Date: Tue, 12 Apr 2016 22:51:28 +1000 Subject: [PATCH] Fix up rspec deprecation warnings. --- spec/classes/java_spec.rb | 86 +++++++++++----------- spec/defines/oracle_spec.rb | 50 ++++++------- spec/unit/facter/java_default_home_spec.rb | 4 +- spec/unit/facter/java_libjvm_path_spec.rb | 2 +- spec/unit/facter/java_version_spec.rb | 4 +- 5 files changed, 73 insertions(+), 73 deletions(-) diff --git a/spec/classes/java_spec.rb b/spec/classes/java_spec.rb index 4680724..46d04e9 100644 --- a/spec/classes/java_spec.rb +++ b/spec/classes/java_spec.rb @@ -4,181 +4,181 @@ describe 'java', :type => :class do context 'select openjdk for Centos 5.8' do let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Centos', :operatingsystemrelease => '5.8'} } - it { should contain_package('java').with_name('java-1.6.0-openjdk-devel') } + it { is_expected.to contain_package('java').with_name('java-1.6.0-openjdk-devel') } end context 'select openjdk for Centos 6.3' do let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Centos', :operatingsystemrelease => '6.3'} } - it { should contain_package('java').with_name('java-1.7.0-openjdk-devel') } + it { is_expected.to contain_package('java').with_name('java-1.7.0-openjdk-devel') } end context 'select openjdk for Centos 7.1.1503' do let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Centos', :operatingsystemrelease => '7.1.1503'} } - it { should contain_package('java').with_name('java-1.8.0-openjdk-devel') } + it { is_expected.to contain_package('java').with_name('java-1.8.0-openjdk-devel') } end context 'select openjdk for Centos 6.2' do let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Centos', :operatingsystemrelease => '6.2'} } - it { should contain_package('java').with_name('java-1.6.0-openjdk-devel') } - it { should_not contain_exec('update-java-alternatives') } + it { is_expected.to contain_package('java').with_name('java-1.6.0-openjdk-devel') } + it { is_expected.to_not contain_exec('update-java-alternatives') } end context 'select Oracle JRE with alternatives for Centos 6.3' do let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Centos', :operatingsystemrelease => '6.3'} } let(:params) { { 'package' => 'jre', 'java_alternative' => '/usr/bin/java', 'java_alternative_path' => '/usr/java/jre1.7.0_67/bin/java'} } - it { should contain_package('java').with_name('jre') } - it { should contain_exec('create-java-alternatives').with_command('alternatives --install /usr/bin/java java /usr/java/jre1.7.0_67/bin/java 20000') } - it { should contain_exec('update-java-alternatives').with_command('alternatives --set java /usr/java/jre1.7.0_67/bin/java') } + it { is_expected.to contain_package('java').with_name('jre') } + it { is_expected.to contain_exec('create-java-alternatives').with_command('alternatives --install /usr/bin/java java /usr/java/jre1.7.0_67/bin/java 20000') } + it { is_expected.to contain_exec('update-java-alternatives').with_command('alternatives --set java /usr/java/jre1.7.0_67/bin/java') } end context 'select openjdk for Fedora 20' do let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Fedora', :operatingsystemrelease => '20'} } - it { should contain_package('java').with_name('java-1.7.0-openjdk-devel') } + it { is_expected.to contain_package('java').with_name('java-1.7.0-openjdk-devel') } end context 'select openjdk for Fedora 21' do let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Fedora', :operatingsystemrelease => '21'} } - it { should contain_package('java').with_name('java-1.8.0-openjdk-devel') } + it { is_expected.to contain_package('java').with_name('java-1.8.0-openjdk-devel') } end context 'select passed value for Fedora 20' do let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Fedora', :operatingsystemrelease => '20'} } let(:params) { { 'distribution' => 'jre' } } - it { should contain_package('java').with_name('java-1.7.0-openjdk') } + it { is_expected.to contain_package('java').with_name('java-1.7.0-openjdk') } end context 'select passed value for Fedora 21' do let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Fedora', :operatingsystemrelease => '21'} } let(:params) { { 'distribution' => 'jre' } } - it { should contain_package('java').with_name('java-1.8.0-openjdk') } + it { is_expected.to contain_package('java').with_name('java-1.8.0-openjdk') } end context 'select passed value for Fedora 21 with yum option' do let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Fedora', :operatingsystemrelease => '21'} } let(:params) { { 'distribution' => 'jre' } } let(:params) { { 'package_options' => ['--skip-broken'] } } - it { should contain_package('java') } + it { is_expected.to contain_package('java') } end context 'select passed value for Centos 5.3' do let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Centos', :operatingsystemrelease => '5.3'} } let(:params) { { 'package' => 'jdk' } } - it { should contain_package('java').with_name('jdk') } - it { should_not contain_exec('update-java-alternatives') } + it { is_expected.to contain_package('java').with_name('jdk') } + it { is_expected.to_not contain_exec('update-java-alternatives') } end context 'select default for Centos 5.3' do let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Centos', :operatingsystemrelease => '5.3'} } - it { should contain_package('java').with_name('java-1.6.0-openjdk-devel') } - it { should_not contain_exec('update-java-alternatives') } + it { is_expected.to contain_package('java').with_name('java-1.6.0-openjdk-devel') } + it { is_expected.to_not contain_exec('update-java-alternatives') } end context 'select default for Debian Wheezy' do let(:facts) { {:osfamily => 'Debian', :operatingsystem => 'Debian', :lsbdistcodename => 'wheezy', :operatingsystemrelease => '7.1', :architecture => 'amd64',} } - it { should contain_package('java').with_name('openjdk-7-jdk') } - it { should contain_exec('update-java-alternatives').with_command('update-java-alternatives --set java-1.7.0-openjdk-amd64 --jre') } + it { is_expected.to contain_package('java').with_name('openjdk-7-jdk') } + it { is_expected.to contain_exec('update-java-alternatives').with_command('update-java-alternatives --set java-1.7.0-openjdk-amd64 --jre') } end context 'select Oracle JRE for Debian Wheezy' do let(:facts) { {:osfamily => 'Debian', :operatingsystem => 'Debian', :lsbdistcodename => 'wheezy', :operatingsystemrelease => '7.1', :architecture => 'amd64',} } let(:params) { { 'distribution' => 'oracle-jre' } } - it { should contain_package('java').with_name('oracle-j2re1.7') } - it { should contain_exec('update-java-alternatives').with_command('update-java-alternatives --set j2re1.7-oracle --jre') } + it { is_expected.to contain_package('java').with_name('oracle-j2re1.7') } + it { is_expected.to contain_exec('update-java-alternatives').with_command('update-java-alternatives --set j2re1.7-oracle --jre') } end context 'select OpenJDK JRE for Debian Wheezy' do let(:facts) { {:osfamily => 'Debian', :operatingsystem => 'Debian', :lsbdistcodename => 'wheezy', :operatingsystemrelease => '7.1', :architecture => 'amd64',} } let(:params) { { 'distribution' => 'jre' } } - it { should contain_package('java').with_name('openjdk-7-jre-headless') } - it { should contain_exec('update-java-alternatives').with_command('update-java-alternatives --set java-1.7.0-openjdk-amd64 --jre-headless') } + it { is_expected.to contain_package('java').with_name('openjdk-7-jre-headless') } + it { is_expected.to contain_exec('update-java-alternatives').with_command('update-java-alternatives --set java-1.7.0-openjdk-amd64 --jre-headless') } end context 'select default for Debian Squeeze' do let(:facts) { {:osfamily => 'Debian', :operatingsystem => 'Debian', :lsbdistcodename => 'squeeze', :operatingsystemrelease => '6.0.5', :architecture => 'amd64',} } - it { should contain_package('java').with_name('openjdk-6-jdk') } - it { should contain_exec('update-java-alternatives').with_command('update-java-alternatives --set java-6-openjdk-amd64 --jre') } + it { is_expected.to contain_package('java').with_name('openjdk-6-jdk') } + it { is_expected.to contain_exec('update-java-alternatives').with_command('update-java-alternatives --set java-6-openjdk-amd64 --jre') } end context 'select Oracle JRE for Debian Squeeze' do let(:facts) { {:osfamily => 'Debian', :operatingsystem => 'Debian', :lsbdistcodename => 'squeeze', :operatingsystemrelease => '6.0.5', :architecture => 'amd64',} } let(:params) { { 'distribution' => 'sun-jre', } } - it { should contain_package('java').with_name('sun-java6-jre') } - it { should contain_exec('update-java-alternatives').with_command('update-java-alternatives --set java-6-sun --jre') } + it { is_expected.to contain_package('java').with_name('sun-java6-jre') } + it { is_expected.to contain_exec('update-java-alternatives').with_command('update-java-alternatives --set java-6-sun --jre') } end context 'select OpenJDK JRE for Debian Squeeze' do let(:facts) { {:osfamily => 'Debian', :operatingsystem => 'Debian', :lsbdistcodename => 'squeeze', :operatingsystemrelease => '6.0.5', :architecture => 'amd64',} } let(:params) { { 'distribution' => 'jre', } } - it { should contain_package('java').with_name('openjdk-6-jre-headless') } - it { should contain_exec('update-java-alternatives').with_command('update-java-alternatives --set java-6-openjdk-amd64 --jre-headless') } + it { is_expected.to contain_package('java').with_name('openjdk-6-jre-headless') } + it { is_expected.to contain_exec('update-java-alternatives').with_command('update-java-alternatives --set java-6-openjdk-amd64 --jre-headless') } end context 'select random alternative for Debian Wheezy' do let(:facts) { {:osfamily => 'Debian', :operatingsystem => 'Debian', :lsbdistcodename => 'wheezy', :operatingsystemrelease => '7.1', :architecture => 'amd64',} } let(:params) { { 'java_alternative' => 'bananafish' } } - it { should contain_package('java').with_name('openjdk-7-jdk') } - it { should contain_exec('update-java-alternatives').with_command('update-java-alternatives --set bananafish --jre') } + it { is_expected.to contain_package('java').with_name('openjdk-7-jdk') } + it { is_expected.to contain_exec('update-java-alternatives').with_command('update-java-alternatives --set bananafish --jre') } end context 'select jdk for Ubuntu Vivid (15.04)' do let(:facts) { {:osfamily => 'Debian', :operatingsystem => 'Ubuntu', :lsbdistcodename => 'vivid', :operatingsystemrelease => '15.04', :architecture => 'amd64',} } let(:params) { { 'distribution' => 'jdk' } } - it { should contain_package('java').with_name('openjdk-8-jdk') } + it { is_expected.to contain_package('java').with_name('openjdk-8-jdk') } end context 'select jre for Ubuntu Vivid (15.04)' do let(:facts) { {:osfamily => 'Debian', :operatingsystem => 'Ubuntu', :lsbdistcodename => 'vivid', :operatingsystemrelease => '15.04', :architecture => 'amd64',} } let(:params) { { 'distribution' => 'jre' } } - it { should contain_package('java').with_name('openjdk-8-jre-headless') } + it { is_expected.to contain_package('java').with_name('openjdk-8-jre-headless') } end context 'select openjdk for Amazon Linux' do let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Amazon', :operatingsystemrelease => '3.4.43-43.43.amzn1.x86_64'} } - it { should contain_package('java').with_name('java-1.7.0-openjdk-devel') } + it { is_expected.to contain_package('java').with_name('java-1.7.0-openjdk-devel') } end context 'select passed value for Amazon Linux' do let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Amazon', :operatingsystemrelease => '5.3.4.43-43.43.amzn1.x86_64'} } let(:params) { { 'distribution' => 'jre' } } - it { should contain_package('java').with_name('java-1.7.0-openjdk') } + it { is_expected.to contain_package('java').with_name('java-1.7.0-openjdk') } end context 'select openjdk for Oracle Linux' do let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'OracleLinux', :operatingsystemrelease => '6.4'} } - it { should contain_package('java').with_name('java-1.7.0-openjdk-devel') } + it { is_expected.to contain_package('java').with_name('java-1.7.0-openjdk-devel') } end context 'select openjdk for Oracle Linux 6.2' do let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'OracleLinux', :operatingsystemrelease => '6.2'} } - it { should contain_package('java').with_name('java-1.6.0-openjdk-devel') } + it { is_expected.to contain_package('java').with_name('java-1.6.0-openjdk-devel') } end context 'select passed value for Oracle Linux' do let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'OracleLinux', :operatingsystemrelease => '6.3'} } let(:params) { { 'distribution' => 'jre' } } - it { should contain_package('java').with_name('java-1.7.0-openjdk') } + it { is_expected.to contain_package('java').with_name('java-1.7.0-openjdk') } end context 'select passed value for Scientific Linux' do let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Scientific', :operatingsystemrelease => '6.4'} } let(:params) { { 'distribution' => 'jre' } } - it { should contain_package('java').with_name('java-1.7.0-openjdk') } + it { is_expected.to contain_package('java').with_name('java-1.7.0-openjdk') } end context 'select default for OpenSUSE 12.3' do let(:facts) { {:osfamily => 'Suse', :operatingsystem => 'OpenSUSE', :operatingsystemrelease => '12.3'}} - it { should contain_package('java').with_name('java-1_7_0-openjdk-devel')} + it { is_expected.to contain_package('java').with_name('java-1_7_0-openjdk-devel')} end context 'select jdk for OpenBSD' do let(:facts) { {:osfamily => 'OpenBSD'} } - it { should contain_package('java').with_name('jdk') } + it { is_expected.to contain_package('java').with_name('jdk') } end context 'select jre for OpenBSD' do let(:facts) { {:osfamily => 'OpenBSD'} } let(:params) { { 'distribution' => 'jre' } } - it { should contain_package('java').with_name('jre') } + it { is_expected.to contain_package('java').with_name('jre') } end describe 'incompatible OSs' do @@ -215,7 +215,7 @@ describe 'java', :type => :class do }, ].each do |facts| let(:facts) { facts } - it "should fail on #{facts[:operatingsystem]} #{facts[:operatingsystemrelease]}" do + it "is_expected.to fail on #{facts[:operatingsystem]} #{facts[:operatingsystemrelease]}" do expect { catalogue }.to raise_error Puppet::Error, /unsupported platform/ end end diff --git a/spec/defines/oracle_spec.rb b/spec/defines/oracle_spec.rb index 7fca917..dbf3392 100644 --- a/spec/defines/oracle_spec.rb +++ b/spec/defines/oracle_spec.rb @@ -7,43 +7,43 @@ describe 'java::oracle', :type => :define do context 'Oracle Java SE 6 JDK' do let(:params) { {:ensure => 'present', :version => '6', :java_se => 'jdk'} } let :title do 'jdk6' end - it { should contain_archive('/tmp/jdk-6u45-linux-x64-rpm.bin')} - it { should contain_exec('Install Oracle java_se jdk 6').with_command('sh /tmp/jdk-6u45-linux-x64-rpm.bin -x; rpm --force -iv sun*.rpm; rpm --force -iv jdk*.rpm') } + it { is_expected.to contain_archive('/tmp/jdk-6u45-linux-x64-rpm.bin')} + it { is_expected.to contain_exec('Install Oracle java_se jdk 6').with_command('sh /tmp/jdk-6u45-linux-x64-rpm.bin -x; rpm --force -iv sun*.rpm; rpm --force -iv jdk*.rpm') } end context 'Oracle Java SE 7 JDK' do let(:params) { {:ensure => 'present', :version => '7', :java_se => 'jdk'} } let :title do 'jdk7' end - it { should contain_archive('/tmp/jdk-7u80-linux-x64.rpm')} - it { should contain_exec('Install Oracle java_se jdk 7').with_command('rpm --force -iv /tmp/jdk-7u80-linux-x64.rpm') } + it { is_expected.to contain_archive('/tmp/jdk-7u80-linux-x64.rpm')} + it { is_expected.to contain_exec('Install Oracle java_se jdk 7').with_command('rpm --force -iv /tmp/jdk-7u80-linux-x64.rpm') } end context 'Oracle Java SE 8 JDK' do let(:params) { {:ensure => 'present', :version => '8', :java_se => 'jdk'} } let :title do 'jdk8' end - it { should contain_archive('/tmp/jdk-8u51-linux-x64.rpm')} - it { should contain_exec('Install Oracle java_se jdk 8').with_command('rpm --force -iv /tmp/jdk-8u51-linux-x64.rpm') } + it { is_expected.to contain_archive('/tmp/jdk-8u51-linux-x64.rpm')} + it { is_expected.to contain_exec('Install Oracle java_se jdk 8').with_command('rpm --force -iv /tmp/jdk-8u51-linux-x64.rpm') } end context 'Oracle Java SE 6 JRE' do let(:params) { {:ensure => 'present', :version => '6', :java_se => 'jre'} } let :title do 'jre6' end - it { should contain_archive('/tmp/jre-6u45-linux-x64-rpm.bin')} - it { should contain_exec('Install Oracle java_se jre 6').with_command('sh /tmp/jre-6u45-linux-x64-rpm.bin -x; rpm --force -iv sun*.rpm; rpm --force -iv jre*.rpm') } + it { is_expected.to contain_archive('/tmp/jre-6u45-linux-x64-rpm.bin')} + it { is_expected.to contain_exec('Install Oracle java_se jre 6').with_command('sh /tmp/jre-6u45-linux-x64-rpm.bin -x; rpm --force -iv sun*.rpm; rpm --force -iv jre*.rpm') } end context 'Oracle Java SE 7 JRE' do let(:params) { {:ensure => 'present', :version => '7', :java_se => 'jre'} } let :title do 'jre7' end - it { should contain_archive('/tmp/jre-7u80-linux-x64.rpm')} - it { should contain_exec('Install Oracle java_se jre 7').with_command('rpm --force -iv /tmp/jre-7u80-linux-x64.rpm') } + it { is_expected.to contain_archive('/tmp/jre-7u80-linux-x64.rpm')} + it { is_expected.to contain_exec('Install Oracle java_se jre 7').with_command('rpm --force -iv /tmp/jre-7u80-linux-x64.rpm') } end context 'select Oracle Java SE 8 JRE' do let(:params) { {:ensure => 'present', :version => '8', :java_se => 'jre'} } let :title do 'jre8' end - it { should contain_archive('/tmp/jre-8u51-linux-x64.rpm')} - it { should contain_exec('Install Oracle java_se jre 8').with_command('rpm --force -iv /tmp/jre-8u51-linux-x64.rpm') } + it { is_expected.to contain_archive('/tmp/jre-8u51-linux-x64.rpm')} + it { is_expected.to contain_exec('Install Oracle java_se jre 8').with_command('rpm --force -iv /tmp/jre-8u51-linux-x64.rpm') } end end @@ -54,43 +54,43 @@ describe 'java::oracle', :type => :define do context 'select Oracle Java SE 6 JDK on RedHat family, 32-bit' do let(:params) { {:ensure => 'present', :version => '6', :java_se => 'jdk'} } let :title do 'jdk6' end - it { should contain_archive('/tmp/jdk-6u45-linux-i586-rpm.bin')} - it { should contain_exec('Install Oracle java_se jdk 6').with_command('sh /tmp/jdk-6u45-linux-i586-rpm.bin -x; rpm --force -iv sun*.rpm; rpm --force -iv jdk*.rpm') } + it { is_expected.to contain_archive('/tmp/jdk-6u45-linux-i586-rpm.bin')} + it { is_expected.to contain_exec('Install Oracle java_se jdk 6').with_command('sh /tmp/jdk-6u45-linux-i586-rpm.bin -x; rpm --force -iv sun*.rpm; rpm --force -iv jdk*.rpm') } end context 'select Oracle Java SE 7 JDK on RedHat family, 32-bit' do let(:params) { {:ensure => 'present', :version => '7', :java_se => 'jdk'} } let :title do 'jdk7' end - it { should contain_archive('/tmp/jdk-7u80-linux-i586.rpm')} - it { should contain_exec('Install Oracle java_se jdk 7').with_command('rpm --force -iv /tmp/jdk-7u80-linux-i586.rpm') } + it { is_expected.to contain_archive('/tmp/jdk-7u80-linux-i586.rpm')} + it { is_expected.to contain_exec('Install Oracle java_se jdk 7').with_command('rpm --force -iv /tmp/jdk-7u80-linux-i586.rpm') } end context 'select Oracle Java SE 8 JDK on RedHat family, 32-bit' do let(:params) { {:ensure => 'present', :version => '8', :java_se => 'jdk'} } let :title do 'jdk8' end - it { should contain_archive('/tmp/jdk-8u51-linux-i586.rpm')} - it { should contain_exec('Install Oracle java_se jdk 8').with_command('rpm --force -iv /tmp/jdk-8u51-linux-i586.rpm') } + it { is_expected.to contain_archive('/tmp/jdk-8u51-linux-i586.rpm')} + it { is_expected.to contain_exec('Install Oracle java_se jdk 8').with_command('rpm --force -iv /tmp/jdk-8u51-linux-i586.rpm') } end context 'select Oracle Java SE 6 JRE on RedHat family, 32-bit' do let(:params) { {:ensure => 'present', :version => '6', :java_se => 'jre'} } let :title do 'jdk6' end - it { should contain_archive('/tmp/jre-6u45-linux-i586-rpm.bin')} - it { should contain_exec('Install Oracle java_se jre 6').with_command('sh /tmp/jre-6u45-linux-i586-rpm.bin -x; rpm --force -iv sun*.rpm; rpm --force -iv jre*.rpm') } + it { is_expected.to contain_archive('/tmp/jre-6u45-linux-i586-rpm.bin')} + it { is_expected.to contain_exec('Install Oracle java_se jre 6').with_command('sh /tmp/jre-6u45-linux-i586-rpm.bin -x; rpm --force -iv sun*.rpm; rpm --force -iv jre*.rpm') } end context 'select Oracle Java SE 7 JRE on RedHat family, 32-bit' do let(:params) { {:ensure => 'present', :version => '7', :java_se => 'jre'} } let :title do 'jdk7' end - it { should contain_archive('/tmp/jre-7u80-linux-i586.rpm')} - it { should contain_exec('Install Oracle java_se jre 7').with_command('rpm --force -iv /tmp/jre-7u80-linux-i586.rpm') } + it { is_expected.to contain_archive('/tmp/jre-7u80-linux-i586.rpm')} + it { is_expected.to contain_exec('Install Oracle java_se jre 7').with_command('rpm --force -iv /tmp/jre-7u80-linux-i586.rpm') } end context 'select Oracle Java SE 8 JRE on RedHat family, 32-bit' do let(:params) { {:ensure => 'present', :version => '8', :java_se => 'jre'} } let :title do 'jdk8' end - it { should contain_archive('/tmp/jre-8u51-linux-i586.rpm')} - it { should contain_exec('Install Oracle java_se jre 8').with_command('rpm --force -iv /tmp/jre-8u51-linux-i586.rpm') } + it { is_expected.to contain_archive('/tmp/jre-8u51-linux-i586.rpm')} + it { is_expected.to contain_exec('Install Oracle java_se jre 8').with_command('rpm --force -iv /tmp/jre-8u51-linux-i586.rpm') } end end @@ -134,7 +134,7 @@ describe 'java::oracle', :type => :define do ].each do |facts| let(:facts) { facts } let :title do 'jdk' end - it "should fail on #{facts[:operatingsystem]} #{facts[:operatingsystemrelease]}" do + it "is_expected.to fail on #{facts[:operatingsystem]} #{facts[:operatingsystemrelease]}" do expect { catalogue }.to raise_error Puppet::Error, /unsupported platform/ end end diff --git a/spec/unit/facter/java_default_home_spec.rb b/spec/unit/facter/java_default_home_spec.rb index 32ebed9..3551013 100644 --- a/spec/unit/facter/java_default_home_spec.rb +++ b/spec/unit/facter/java_default_home_spec.rb @@ -14,7 +14,7 @@ describe Facter::Util::Fact do EOS Facter::Util::Resolution.expects(:which).with("readlink").returns(true) Facter::Util::Resolution.expects(:exec).with("readlink -e /usr/bin/java").returns(java_path_output) - Facter.value(:java_default_home).should == "/usr/lib/jvm/java-7-openjdk-amd64" + expect(Facter.value(:java_default_home)).to eql "/usr/lib/jvm/java-7-openjdk-amd64" end end @@ -22,7 +22,7 @@ describe Facter::Util::Fact do it do Facter::Util::Resolution.stubs(:exec) Facter::Util::Resolution.expects(:which).with("readlink").at_least(1).returns(false) - Facter.value(:java_default_home).should be_nil + expect(Facter.value(:java_default_home)).to be_nil end end end diff --git a/spec/unit/facter/java_libjvm_path_spec.rb b/spec/unit/facter/java_libjvm_path_spec.rb index ded1a4f..ea63a1c 100644 --- a/spec/unit/facter/java_libjvm_path_spec.rb +++ b/spec/unit/facter/java_libjvm_path_spec.rb @@ -13,7 +13,7 @@ describe Facter::Util::Fact do context 'returns libjvm path' do context 'on Linux' do it do - Facter.value(:java_libjvm_path).should == "/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/server" + expect(Facter.value(:java_libjvm_path)).to eql "/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/server" end end end diff --git a/spec/unit/facter/java_version_spec.rb b/spec/unit/facter/java_version_spec.rb index 7d1aa1b..2b8a699 100644 --- a/spec/unit/facter/java_version_spec.rb +++ b/spec/unit/facter/java_version_spec.rb @@ -36,7 +36,7 @@ Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode) EOS Facter::Util::Resolution.expects(:exec).with("/usr/libexec/java_home --failfast 2>&1").returns("/Library/Java/JavaVirtualMachines/jdk1.7.0_71.jdk/Contents/Home") Facter::Util::Resolution.expects(:exec).with("java -Xmx8m -version 2>&1").returns(java_version_output) - Facter.value(:java_version).should == "1.7.0_71" + expect(Facter.value(:java_version)).to eql "1.7.0_71" end end context 'on other systems' do @@ -74,7 +74,7 @@ Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode) let(:facts) { {:operatingsystem => 'Darwin'} } it do Facter::Util::Resolution.expects(:exec).at_least(1).with("/usr/libexec/java_home --failfast 2>&1").returns('Unable to find any JVMs matching version "(null)".') - Facter.value(:java_version).should be_nil + expect(Facter.value(:java_version)).to be_nil end end context 'on other systems' do