spec/rake/funnel/support/msdeploy/registry_patch_spec.rb in rake-funnel-0.21.0 vs spec/rake/funnel/support/msdeploy/registry_patch_spec.rb in rake-funnel-0.21.1

- old
+ new

@@ -38,11 +38,11 @@ end context 'on Windows', skip: ('Windows Registry not available' unless defined?(::Win32::Registry)) do let(:root) { Win32::Registry::HKEY_LOCAL_MACHINE } - let(:keys) do + let(:registry_keys) do described_class::KEYS.map do |key| instance_double(Win32::Registry, keyname: key) end end @@ -60,41 +60,41 @@ allow(root).to receive(:create).with(File.dirname(key.keyname)).and_yield(key) end context 'MSDeploy registry key and "Version" value does not exist' do before do - keys.each do |key| + registry_keys.each do |key| allow(key).to receive(:created?).and_return(true) allow(key).to receive(:[]).and_raise(key_access_error) allow(key).to receive(:[]=) allow(key).to receive(:delete_key) end end before do - keys.each do |key| + registry_keys.each do |key| allow_open_or_create(key) allow_open_for_deletion(key) end end before do described_class.new end it 'should create the key' do - keys.each do |key| + registry_keys.each do |key| expect(root).to have_received(:create).with(key.keyname) end end it 'should create the version' do - expect(keys).to all(have_received(:[]=).with('Version', described_class::FAKE_VERSION)) + expect(registry_keys).to all(have_received(:[]=).with('Version', described_class::FAKE_VERSION)) end it 'should delete the key' do - keys.each do |key| # rubocop:disable RSpec/IteratedExpectation + registry_keys.each do |key| # rubocop:disable RSpec/IteratedExpectation expect(key).to have_received(:delete_key).with(File.basename(key.keyname), true) end end end @@ -112,18 +112,18 @@ end end context 'MSDeploy registry key does exist' do before do - keys.each do |key| + registry_keys.each do |key| allow_open_or_create(key) end end context '"Version" value does not exist' do before do - keys.each do |key| + registry_keys.each do |key| allow(key).to receive(:created?).and_return(false) allow(key).to receive(:[]).and_raise(key_access_error) allow(key).to receive(:[]=) allow(key).to receive(:delete_value) end @@ -132,20 +132,20 @@ before do described_class.new end it 'should create the version' do - expect(keys).to all(have_received(:[]=).with('Version', described_class::FAKE_VERSION)) + expect(registry_keys).to all(have_received(:[]=).with('Version', described_class::FAKE_VERSION)) end it 'should delete the version' do - expect(keys).to all(have_received(:delete_value).with(described_class::VERSION_VALUE)) + expect(registry_keys).to all(have_received(:delete_value).with(described_class::VERSION_VALUE)) end end context '"Version" value does exist' do before do - keys.each do |key| + registry_keys.each do |key| allow(key).to receive(:created?).and_return(false) allow(key).to receive(:[]) end end