diff options
Diffstat (limited to 'spec')
-rw-r--r-- | spec/functional/resource/link_spec.rb | 2 | ||||
-rw-r--r-- | spec/functional/resource/user/useradd_spec.rb | 2 | ||||
-rw-r--r-- | spec/functional/run_lock_spec.rb | 2 | ||||
-rw-r--r-- | spec/stress/win32/security_spec.rb | 2 | ||||
-rw-r--r-- | spec/support/chef_helpers.rb | 2 | ||||
-rw-r--r-- | spec/support/mock/constant.rb | 2 | ||||
-rw-r--r-- | spec/support/shared/unit/provider/file.rb | 2 | ||||
-rw-r--r-- | spec/unit/api_client/registration_spec.rb | 2 | ||||
-rw-r--r-- | spec/unit/chef_fs/parallelizer.rb | 4 | ||||
-rw-r--r-- | spec/unit/knife/cookbook_site_download_spec.rb | 4 | ||||
-rw-r--r-- | spec/unit/provider/link_spec.rb | 2 |
11 files changed, 13 insertions, 13 deletions
diff --git a/spec/functional/resource/link_spec.rb b/spec/functional/resource/link_spec.rb index f55b9fca1e..7ea3b44a3d 100644 --- a/spec/functional/resource/link_spec.rb +++ b/spec/functional/resource/link_spec.rb @@ -73,7 +73,7 @@ describe Chef::Resource::Link do end def canonicalize(path) - windows? ? path.gsub("/", '\\') : path + windows? ? path.tr("/", '\\') : path end def symlink(a, b) diff --git a/spec/functional/resource/user/useradd_spec.rb b/spec/functional/resource/user/useradd_spec.rb index 6ac855fbfc..f5b228a4df 100644 --- a/spec/functional/resource/user/useradd_spec.rb +++ b/spec/functional/resource/user/useradd_spec.rb @@ -508,7 +508,7 @@ describe Chef::Provider::User::Useradd, metadata do let(:user_locked_context?) { false } def shadow_entry - etc_shadow.lines.select { |l| l.include?(username) }.first + etc_shadow.lines.find { |l| l.include?(username) } end def shadow_password diff --git a/spec/functional/run_lock_spec.rb b/spec/functional/run_lock_spec.rb index b0e52471db..f1e480c917 100644 --- a/spec/functional/run_lock_spec.rb +++ b/spec/functional/run_lock_spec.rb @@ -343,7 +343,7 @@ describe Chef::RunLock do write_to_process.print "#{to_event}\n" # Run the background block - background_block.call if background_block + yield if background_block # Wait until it gets there Timeout.timeout(CLIENT_PROCESS_TIMEOUT) do diff --git a/spec/stress/win32/security_spec.rb b/spec/stress/win32/security_spec.rb index 4fbd1dac9c..58cf7b3357 100644 --- a/spec/stress/win32/security_spec.rb +++ b/spec/stress/win32/security_spec.rb @@ -27,7 +27,7 @@ end describe "Chef::ReservedNames::Win32::Security", :windows_only do def monkeyfoo - File.join(CHEF_SPEC_DATA, "monkeyfoo").gsub("/", "\\") + File.join(CHEF_SPEC_DATA, "monkeyfoo").tr("/", "\\") end before :all do diff --git a/spec/support/chef_helpers.rb b/spec/support/chef_helpers.rb index aa60737c86..f64c14da4d 100644 --- a/spec/support/chef_helpers.rb +++ b/spec/support/chef_helpers.rb @@ -81,7 +81,7 @@ end # This is a helper to canonicalize paths that we're using in the file # tests. def canonicalize_path(path) - windows? ? path.gsub("/", '\\') : path + windows? ? path.tr("/", '\\') : path end # Check if a cmd exists on the PATH diff --git a/spec/support/mock/constant.rb b/spec/support/mock/constant.rb index a2abc1905e..942905144f 100644 --- a/spec/support/mock/constant.rb +++ b/spec/support/mock/constant.rb @@ -13,7 +13,7 @@ def mock_constants(constants, &block) end begin - block.call + yield ensure constants.each do |constant, val| source_object, const_name = parse_constant(constant) diff --git a/spec/support/shared/unit/provider/file.rb b/spec/support/shared/unit/provider/file.rb index 7ddd51db80..2b2c7255cc 100644 --- a/spec/support/shared/unit/provider/file.rb +++ b/spec/support/shared/unit/provider/file.rb @@ -37,7 +37,7 @@ end # forwards-vs-reverse slashes on windows sucks def windows_path - windows? ? normalized_path.gsub(/\\/, "/") : normalized_path + windows? ? normalized_path.tr('\\', "/") : normalized_path end # this is all getting a bit stupid, CHEF-4802 cut to remove all this diff --git a/spec/unit/api_client/registration_spec.rb b/spec/unit/api_client/registration_spec.rb index f086993860..0f036766da 100644 --- a/spec/unit/api_client/registration_spec.rb +++ b/spec/unit/api_client/registration_spec.rb @@ -98,7 +98,7 @@ describe Chef::ApiClient::Registration do it "has an HTTP client configured with validator credentials" do expect(registration.http_api).to be_a_kind_of(Chef::ServerAPI) expect(registration.http_api.options[:client_name]).to eq("test-validator") - auth = registration.http_api.middlewares.select { |klass| klass.kind_of? Chef::HTTP::Authenticator }.first + auth = registration.http_api.middlewares.find { |klass| klass.kind_of? Chef::HTTP::Authenticator } expect(auth.client_name).to eq("test-validator") end diff --git a/spec/unit/chef_fs/parallelizer.rb b/spec/unit/chef_fs/parallelizer.rb index 20edbcdcde..96b713b547 100644 --- a/spec/unit/chef_fs/parallelizer.rb +++ b/spec/unit/chef_fs/parallelizer.rb @@ -466,12 +466,12 @@ describe Chef::ChefFS::Parallelizer do def each(&each_block) @values.each do |value| @num_processed += 1 - each_block.call(value) + yield(value) end if @block @block.call do |value| @num_processed += 1 - each_block.call(value) + yield(value) end end end diff --git a/spec/unit/knife/cookbook_site_download_spec.rb b/spec/unit/knife/cookbook_site_download_spec.rb index d7f26f2f2e..d283bd417f 100644 --- a/spec/unit/knife/cookbook_site_download_spec.rb +++ b/spec/unit/knife/cookbook_site_download_spec.rb @@ -28,7 +28,7 @@ describe Chef::Knife::CookbookSiteDownload do @stderr = StringIO.new @cookbook_api_url = "https://supermarket.chef.io/api/v1/cookbooks" @version = "1.0.2" - @version_us = @version.gsub ".", "_" + @version_us = @version.tr ".", "_" @current_data = { "deprecated" => false, "latest_version" => "#{@cookbook_api_url}/apache2/versions/#{@version_us}", "replacement" => "other_apache2" } @@ -120,7 +120,7 @@ describe Chef::Knife::CookbookSiteDownload do context "downloading a cookbook of a specific version" do before do @version = "1.0.1" - @version_us = @version.gsub ".", "_" + @version_us = @version.tr ".", "_" @cookbook_data = { "version" => @version, "file" => "http://example.com/apache2_#{@version_us}.tgz" } @temp_file = double(:path => "/tmp/apache2_#{@version_us}.tgz") diff --git a/spec/unit/provider/link_spec.rb b/spec/unit/provider/link_spec.rb index 31065d7bfd..6bb08551a2 100644 --- a/spec/unit/provider/link_spec.rb +++ b/spec/unit/provider/link_spec.rb @@ -39,7 +39,7 @@ describe Chef::Resource::Link, :not_supported_on_win2k3 do end def canonicalize(path) - Chef::Platform.windows? ? path.gsub("/", '\\') : path + Chef::Platform.windows? ? path.tr("/", '\\') : path end describe "when the target is a symlink" do |