diff --git a/spec/functional/resource/registry_spec.rb b/spec/functional/resource/registry_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/functional/resource/registry_spec.rb
+++ b/spec/functional/resource/registry_spec.rb
@@ -55,19 +55,13 @@ describe Chef::Resource::RegistryKey, :windows_only do
 
   def clean_registry
     # clean 64-bit space on WOW64
-    begin
-      hive_class.open(key_parent, Win32::Registry::KEY_WRITE | 0x0100) do |reg|
-        reg.delete_key(child, true)
-      end
-    rescue
-    end
+      @registry.architecture = :x86_64
+      @registry.delete_key(reg_parent, true)
+      @registry.architecture = :machine
     # clean 32-bit space on WOW64
-    begin
-      hive_class.open(key_parent, Win32::Registry::KEY_WRITE | 0x0200) do |reg|
-        reg.delete_key(child, true)
-      end
-    rescue
-    end
+      @registry.architecture = :i386
+      @registry.delete_key(reg_parent, true)
+      @registry.architecture = :machine
   end
 
   def reset_registry
changing tests to use new delete function to delete keys