spec/beaker/host/unix/file_spec.rb in beaker-4.38.1 vs spec/beaker/host/unix/file_spec.rb in beaker-4.39.0
- old
+ new
@@ -22,20 +22,20 @@
@logger
end
end
- let (:opts) { @opts || {} }
- let (:logger) { double( 'logger' ).as_null_object }
- let (:platform) {
+ let(:opts) { @opts || {} }
+ let(:logger) { double( 'logger' ).as_null_object }
+ let(:platform) {
if @platform
{ 'platform' => Beaker::Platform.new( @platform) }
else
{ 'platform' => Beaker::Platform.new( 'osx-10.9-x86_64' ) }
end
}
- let (:instance) { UnixFileTest.new(opts.merge(platform), logger) }
+ let(:instance) { UnixFileTest.new(opts.merge(platform), logger) }
describe '#repo_type' do
['centos','redhat'].each do |platform|
it "returns correctly for platform '#{platform}'" do
@@ -92,50 +92,50 @@
describe '#repo_filename' do
['centos','redhat'].each do |platform|
it "sets the el portion correctly for '#{platform}'" do
@platform = "#{platform}-5-x86_64"
- allow( instance ).to receive( :is_pe? ) { false }
+ allow( instance ).to receive( :is_pe? ).and_return(false)
filename = instance.repo_filename( 'pkg_name', 'pkg_version7' )
expect( filename ).to match( /sion7\-el\-/ )
end
end
it 'sets the sles portion correctly for sles platforms' do
@platform = 'sles-11-x86_64'
- allow( instance ).to receive( :is_pe? ) { false }
+ allow( instance ).to receive( :is_pe? ).and_return(false)
filename = instance.repo_filename( 'pkg_name', 'pkg_version7' )
expect( filename ).to match( /sion7\-sles\-/ )
end
it 'sets the opensuse portion correctly for opensuse platforms' do
@platform = 'opensuse-15-x86_64'
- allow( instance ).to receive( :is_pe? ) { false }
+ allow( instance ).to receive( :is_pe? ).and_return(false)
filename = instance.repo_filename( 'pkg_name', 'pkg_version7' )
expect( filename ).to match( /sion7\-opensuse\-/ )
end
it 'builds the filename correctly for el-based platforms' do
@platform = 'el-21-x86_64'
- allow( instance ).to receive( :is_pe? ) { false }
+ allow( instance ).to receive( :is_pe? ).and_return(false)
filename = instance.repo_filename( 'pkg_name', 'pkg_version8' )
correct = 'pl-pkg_name-pkg_version8-el-21-x86_64.repo'
expect( filename ).to be === correct
end
it 'builds the filename correctly for redhatfips platforms' do
@platform = 'el-7-x86_64'
allow(instance).to receive(:[]).with('platform') { platform['platform'] }
- expect(instance).to receive(:[]).with('packaging_platform') { 'redhatfips-7-x86_64' }
+ expect(instance).to receive(:[]).with('packaging_platform').and_return('redhatfips-7-x86_64')
filename = instance.repo_filename('pkg_name', 'pkg_version')
correct = 'pl-pkg_name-pkg_version-redhatfips-7-x86_64.repo'
expect( filename ).to be === correct
end
it 'adds in the PE portion of the filename correctly for el-based PE hosts' do
@platform = 'el-21-x86_64'
- allow( instance ).to receive( :is_pe? ) { true }
+ allow( instance ).to receive( :is_pe? ).and_return(true)
filename = instance.repo_filename( 'pkg_name', 'pkg_version9' )
correct = 'pl-pkg_name-pkg_version9-el-21-x86_64.repo'
expect( filename ).to be === correct
end
@@ -153,11 +153,11 @@
expect( filename ).to be === correct
end
it 'adds wrlinux to variant on cisco platforms' do
@platform = 'cisco_nexus-7-x86_64'
- allow( instance ).to receive( :is_pe? ) { false }
+ allow( instance ).to receive( :is_pe? ).and_return(false)
filename = instance.repo_filename( 'pkg_name', 'pkg_version12' )
expect( filename ).to match( /sion12\-cisco\-wrlinux\-/ )
end
it 'errors for non-el or debian-based platforms' do
@@ -192,12 +192,12 @@
expect( text ).to match( /basedir\=default/ )
end
end
describe '#chown' do
- let (:user) { 'someuser' }
- let (:path) { '/path/to/chown/on' }
+ let(:user) { 'someuser' }
+ let(:path) { '/path/to/chown/on' }
it 'calls the system method' do
expect( instance ).to receive( :execute ).with( "chown #{user} #{path}" ).and_return( 0 )
expect( instance.chown( user, path ) ).to be === 0
end
@@ -207,11 +207,12 @@
instance.chown( user, path, true )
end
end
describe '#cat' do
- let (:path) { '/path/to/cat/on' }
+ let(:path) { '/path/to/cat/on' }
+
it 'calls cat for path' do
expect( instance ).to receive( :execute ).with( "cat #{path}" ).and_return( 0 )
expect( instance.cat( path ) ).to be === 0
end
end
@@ -237,12 +238,12 @@
end
end
end
describe '#chgrp' do
- let (:group) { 'somegroup' }
- let (:path) { '/path/to/chgrp/on' }
+ let(:group) { 'somegroup' }
+ let(:path) { '/path/to/chgrp/on' }
it 'calls the system method' do
expect( instance ).to receive( :execute ).with( "chgrp #{group} #{path}" ).and_return( 0 )
expect( instance.chgrp( group, path ) ).to be === 0
end
@@ -252,10 +253,10 @@
instance.chgrp( group, path, true )
end
end
describe '#ls_ld' do
- let (:path) { '/path/to/ls_ld' }
+ let(:path) { '/path/to/ls_ld' }
it 'calls the system method' do
expect( instance ).to receive( :execute ).with( "ls -ld #{path}" ).and_return( 0 )
expect( instance.ls_ld( path ) ).to be === 0
end