diff options
Diffstat (limited to 'spec/functional/resource')
-rw-r--r-- | spec/functional/resource/group_spec.rb | 12 | ||||
-rw-r--r-- | spec/functional/resource/link_spec.rb | 14 | ||||
-rw-r--r-- | spec/functional/resource/powershell_script_spec.rb | 8 |
3 files changed, 17 insertions, 17 deletions
diff --git a/spec/functional/resource/group_spec.rb b/spec/functional/resource/group_spec.rb index 7e5b0725c1..a682e9c0c7 100644 --- a/spec/functional/resource/group_spec.rb +++ b/spec/functional/resource/group_spec.rb @@ -307,12 +307,12 @@ describe Chef::Resource::Group, :requires_root_or_running_windows do let(:number) do # Loop until we pick a gid that is not in use. loop do - begin - gid = rand(2000..9999) # avoid low group numbers - return nil if Etc.getgrgid(gid).nil? # returns nil on windows - rescue ArgumentError # group does not exist - return gid - end + + gid = rand(2000..9999) # avoid low group numbers + return nil if Etc.getgrgid(gid).nil? # returns nil on windows + rescue ArgumentError # group does not exist + return gid + end end diff --git a/spec/functional/resource/link_spec.rb b/spec/functional/resource/link_spec.rb index c9177ebc77..fc260845e4 100644 --- a/spec/functional/resource/link_spec.rb +++ b/spec/functional/resource/link_spec.rb @@ -55,13 +55,13 @@ describe Chef::Resource::Link do end after(:each) do - begin - cleanup_link(to) if File.exists?(to) - cleanup_link(target_file) if File.exists?(target_file) - cleanup_link(CHEF_SPEC_BACKUP_PATH) if File.exists?(CHEF_SPEC_BACKUP_PATH) - rescue - puts "Could not remove a file: #{$!}" - end + + cleanup_link(to) if File.exists?(to) + cleanup_link(target_file) if File.exists?(target_file) + cleanup_link(CHEF_SPEC_BACKUP_PATH) if File.exists?(CHEF_SPEC_BACKUP_PATH) + rescue + puts "Could not remove a file: #{$!}" + end def user(user) diff --git a/spec/functional/resource/powershell_script_spec.rb b/spec/functional/resource/powershell_script_spec.rb index 5e8a00fd4d..70442eb2b1 100644 --- a/spec/functional/resource/powershell_script_spec.rb +++ b/spec/functional/resource/powershell_script_spec.rb @@ -273,10 +273,10 @@ describe Chef::Resource::WindowsScript::PowershellScript, :windows_only do context "when running on a 32-bit version of Windows", :windows32_only do it "raises an exception if :x86_64 process architecture is specified" do - begin - expect(resource.architecture(:x86_64)).to raise_error Chef::Exceptions::Win32ArchitectureIncorrect - rescue Chef::Exceptions::Win32ArchitectureIncorrect - end + + expect(resource.architecture(:x86_64)).to raise_error Chef::Exceptions::Win32ArchitectureIncorrect + rescue Chef::Exceptions::Win32ArchitectureIncorrect + end end end |