From 709c2272fcf1bf72ba72dc732c19b4177f5430ac Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Fri, 24 Mar 2023 10:54:06 +0100 Subject: [PATCH] rubocop: Fix Style/MethodCallWithoutArgsParentheses --- .../host_helpers/backup_the_file_test.rb | 18 ++++++++--------- .../dsl/helpers/host_helpers/curl_on_test.rb | 4 ++-- .../dsl/helpers/host_helpers/retry_on_test.rb | 6 +++--- .../dsl/helpers/host_helpers/rsync_to_test.rb | 8 ++++---- .../dsl/helpers/host_helpers/scp_from_test.rb | 6 +++--- .../dsl/helpers/host_helpers/scp_to_test.rb | 6 +++--- .../base/dsl/platform_tag_confiner_test.rb | 4 ++-- lib/beaker/host/aix/exec.rb | 2 +- lib/beaker/host/mac/exec.rb | 2 +- lib/beaker/host/pswindows/file.rb | 6 +++--- lib/beaker/host/unix/exec.rb | 4 ++-- lib/beaker/host/windows/exec.rb | 2 +- spec/beaker/cli_spec.rb | 2 +- spec/beaker/dsl/test_tagging_spec.rb | 20 +++++++++---------- spec/beaker/host_prebuilt_steps_spec.rb | 2 +- spec/beaker/hypervisor/hypervisor_spec.rb | 14 ++++++------- spec/beaker/network_manager_spec.rb | 2 +- spec/beaker/options/hosts_file_parser_spec.rb | 2 +- spec/beaker/options/parser_spec.rb | 4 ++-- spec/beaker/subcommand_spec.rb | 10 +++++----- spec/beaker/test_suite_spec.rb | 14 ++++++------- 21 files changed, 69 insertions(+), 69 deletions(-) diff --git a/acceptance/tests/base/dsl/helpers/host_helpers/backup_the_file_test.rb b/acceptance/tests/base/dsl/helpers/host_helpers/backup_the_file_test.rb index 3cdde60b20..2769caeb7b 100644 --- a/acceptance/tests/base/dsl/helpers/host_helpers/backup_the_file_test.rb +++ b/acceptance/tests/base/dsl/helpers/host_helpers/backup_the_file_test.rb @@ -3,14 +3,14 @@ test_name "dsl::helpers::host_helpers #backup_the_file" do step "#backup_the_file CURRENTLY will return nil if the file does not exist in the source directory" do # NOTE: would expect this to fail with Beaker::Host::CommandFailure - remote_source = default.tmpdir() - remote_destination = default.tmpdir() + remote_source = default.tmpdir + remote_destination = default.tmpdir result = backup_the_file default, remote_source, remote_destination assert_nil result end step "#backup_the_file will fail if the destination directory does not exist" do - remote_source = default.tmpdir() + remote_source = default.tmpdir create_remote_file_from_fixture("simple_text_file", default, remote_source, "puppet.conf") assert_raises Beaker::Host::CommandFailure do @@ -19,10 +19,10 @@ end step "#backup_the_file copies `puppet.conf` from the source to the destination directory" do - remote_source = default.tmpdir() + remote_source = default.tmpdir _remote_filename, contents = create_remote_file_from_fixture("simple_text_file", default, remote_source, "puppet.conf") - remote_destination = default.tmpdir() + remote_destination = default.tmpdir remote_destination_filename = File.join(remote_destination, "puppet.conf.bak") result = backup_the_file default, remote_source, remote_destination @@ -33,10 +33,10 @@ end step "#backup_the_file copies a named file from the source to the destination directory" do - remote_source = default.tmpdir() + remote_source = default.tmpdir _remote_filename, contents = create_remote_file_from_fixture("simple_text_file", default, remote_source, "testfile.txt") - remote_destination = default.tmpdir() + remote_destination = default.tmpdir remote_destination_filename = File.join(remote_destination, "testfile.txt.bak") result = backup_the_file default, remote_source, remote_destination, "testfile.txt" @@ -47,9 +47,9 @@ end step "#backup_the_file CURRENTLY will fail if given a hosts array" do - remote_source = default.tmpdir() + remote_source = default.tmpdir create_remote_file_from_fixture("simple_text_file", default, remote_source, "testfile.txt") - remote_destination = default.tmpdir() + remote_destination = default.tmpdir assert_raises NoMethodError do backup_the_file hosts, remote_source, remote_destination diff --git a/acceptance/tests/base/dsl/helpers/host_helpers/curl_on_test.rb b/acceptance/tests/base/dsl/helpers/host_helpers/curl_on_test.rb index ceedf00201..a1c46498b7 100644 --- a/acceptance/tests/base/dsl/helpers/host_helpers/curl_on_test.rb +++ b/acceptance/tests/base/dsl/helpers/host_helpers/curl_on_test.rb @@ -17,7 +17,7 @@ def host_local_url(host, path) end step "#curl_on can retrieve the contents of a URL, using standard curl options" do - remote_tmpdir = default.tmpdir() + remote_tmpdir = default.tmpdir remote_filename, contents = create_remote_file_from_fixture("simple_text_file", default, remote_tmpdir, "testfile.txt") remote_targetfilename = File.join remote_tmpdir, "outfile.txt" @@ -29,7 +29,7 @@ def host_local_url(host, path) end step "#curl_on can retrieve the contents of a URL, when given a hosts array" do - remote_tmpdir = default.tmpdir() + remote_tmpdir = default.tmpdir on hosts, "mkdir -p #{remote_tmpdir}" remote_filename = contents = nil diff --git a/acceptance/tests/base/dsl/helpers/host_helpers/retry_on_test.rb b/acceptance/tests/base/dsl/helpers/host_helpers/retry_on_test.rb index f72b0a6396..f6abbdc76f 100644 --- a/acceptance/tests/base/dsl/helpers/host_helpers/retry_on_test.rb +++ b/acceptance/tests/base/dsl/helpers/host_helpers/retry_on_test.rb @@ -4,7 +4,7 @@ step "#retry_on CURRENTLY fails with a RuntimeError if command does not pass after all retries" do # NOTE: would have expected this to fail with Beaker::Hosts::CommandFailure - remote_tmpdir = default.tmpdir() + remote_tmpdir = default.tmpdir remote_script_file = File.join(remote_tmpdir, "test.sh") create_remote_file_from_fixture("retry_script", default, remote_tmpdir, "test.sh") @@ -14,7 +14,7 @@ end step "#retry_on succeeds if command passes before retries are exhausted" do - remote_tmpdir = default.tmpdir() + remote_tmpdir = default.tmpdir remote_script_file = File.join(remote_tmpdir, "test.sh") create_remote_file_from_fixture("retry_script", default, remote_tmpdir, "test.sh") @@ -27,7 +27,7 @@ # NOTE: would expect this to work across hosts, or be better documented and # to raise Beaker::Host::CommandFailure - remote_tmpdir = default.tmpdir() + remote_tmpdir = default.tmpdir remote_script_file = File.join(remote_tmpdir, "test.sh") hosts.each do |host| diff --git a/acceptance/tests/base/dsl/helpers/host_helpers/rsync_to_test.rb b/acceptance/tests/base/dsl/helpers/host_helpers/rsync_to_test.rb index ce7e554016..54b358d26e 100644 --- a/acceptance/tests/base/dsl/helpers/host_helpers/rsync_to_test.rb +++ b/acceptance/tests/base/dsl/helpers/host_helpers/rsync_to_test.rb @@ -31,7 +31,7 @@ def rsync_to_with_backups hosts, local_filename, remote_dir step "#rsync_to CURRENTLY fails on windows systems" do Dir.mktmpdir do |local_dir| local_filename, _contents = create_local_file_from_fixture("simple_text_file", local_dir, "testfile.txt") - remote_tmpdir = default.tmpdir() + remote_tmpdir = default.tmpdir assert_raises Beaker::Host::CommandFailure do rsync_to default, local_filename, remote_tmpdir @@ -54,7 +54,7 @@ def rsync_to_with_backups hosts, local_filename, remote_dir confine :except, :hypervisor => 'docker' step "#rsync_to fails if the local file cannot be found" do - remote_tmpdir = default.tmpdir() + remote_tmpdir = default.tmpdir assert_raises IOError do rsync_to default, "/non/existent/file.txt", remote_tmpdir end @@ -116,7 +116,7 @@ def rsync_to_with_backups hosts, local_filename, remote_dir step "#rsync_to creates the file on the remote system" do Dir.mktmpdir do |local_dir| local_filename, contents = create_local_file_from_fixture("simple_text_file", local_dir, "testfile.txt") - remote_tmpdir = default.tmpdir() + remote_tmpdir = default.tmpdir remote_filename = File.join(remote_tmpdir, "testfile.txt") result = rsync_to_with_backups default, local_filename, remote_tmpdir @@ -138,7 +138,7 @@ def rsync_to_with_backups hosts, local_filename, remote_dir step "#rsync_to creates the file on all remote systems when a host array is provided" do Dir.mktmpdir do |local_dir| local_filename, contents = create_local_file_from_fixture("simple_text_file", local_dir, "testfile.txt") - remote_tmpdir = default.tmpdir() + remote_tmpdir = default.tmpdir on hosts, "mkdir -p #{remote_tmpdir}" remote_filename = File.join(remote_tmpdir, "testfile.txt") diff --git a/acceptance/tests/base/dsl/helpers/host_helpers/scp_from_test.rb b/acceptance/tests/base/dsl/helpers/host_helpers/scp_from_test.rb index 95a89a658a..c1250b5f89 100644 --- a/acceptance/tests/base/dsl/helpers/host_helpers/scp_from_test.rb +++ b/acceptance/tests/base/dsl/helpers/host_helpers/scp_from_test.rb @@ -3,7 +3,7 @@ test_name "dsl::helpers::host_helpers #scp_from" do if test_scp_error_on_close? step "#scp_from fails if the local path cannot be found" do - remote_tmpdir = default.tmpdir() + remote_tmpdir = default.tmpdir remote_filename, _contents = create_remote_file_from_fixture("simple_text_file", default, remote_tmpdir, "testfile.txt") assert_raises Beaker::Host::CommandFailure do @@ -22,7 +22,7 @@ step "#scp_from creates the file on the local system" do Dir.mktmpdir do |local_dir| - remote_tmpdir = default.tmpdir() + remote_tmpdir = default.tmpdir remote_filename, contents = create_remote_file_from_fixture("simple_text_file", default, remote_tmpdir, "testfile.txt") scp_from default, remote_filename, local_dir @@ -37,7 +37,7 @@ # file repeatedly to generate an error Dir.mktmpdir do |local_dir| - remote_tmpdir = default.tmpdir() + remote_tmpdir = default.tmpdir remote_filename = File.join(remote_tmpdir, "testfile.txt") on hosts, "mkdir -p #{remote_tmpdir}" on hosts, %{echo "${RANDOM}:${RANDOM}:${RANDOM}" > #{remote_filename}} diff --git a/acceptance/tests/base/dsl/helpers/host_helpers/scp_to_test.rb b/acceptance/tests/base/dsl/helpers/host_helpers/scp_to_test.rb index 184958cadf..29fe000d5b 100644 --- a/acceptance/tests/base/dsl/helpers/host_helpers/scp_to_test.rb +++ b/acceptance/tests/base/dsl/helpers/host_helpers/scp_to_test.rb @@ -2,7 +2,7 @@ test_name "dsl::helpers::host_helpers #scp_to" do step "#scp_to fails if the local file cannot be found" do - remote_tmpdir = default.tmpdir() + remote_tmpdir = default.tmpdir assert_raises IOError do scp_to default, "/non/existent/file.txt", remote_tmpdir end @@ -24,7 +24,7 @@ step "#scp_to creates the file on the remote system" do Dir.mktmpdir do |local_dir| local_filename, contents = create_local_file_from_fixture("simple_text_file", local_dir, "testfile.txt") - remote_tmpdir = default.tmpdir() + remote_tmpdir = default.tmpdir scp_to default, local_filename, remote_tmpdir @@ -38,7 +38,7 @@ Dir.mktmpdir do |local_dir| local_filename, contents = create_local_file_from_fixture("simple_text_file", local_dir, "testfile.txt") - remote_tmpdir = default.tmpdir() + remote_tmpdir = default.tmpdir on hosts, "mkdir -p #{remote_tmpdir}" remote_filename = File.join(remote_tmpdir, "testfile.txt") diff --git a/acceptance/tests/base/dsl/platform_tag_confiner_test.rb b/acceptance/tests/base/dsl/platform_tag_confiner_test.rb index dd93b180ef..ccedd51f58 100644 --- a/acceptance/tests/base/dsl/platform_tag_confiner_test.rb +++ b/acceptance/tests/base/dsl/platform_tag_confiner_test.rb @@ -13,7 +13,7 @@ end step "#{pstc_method_name} can remove hosts from a test, or be skipped if empty" do - assert hosts.length() > 0, "#{pstc_method_name} did not have enough hosts to test" + assert hosts.length > 0, "#{pstc_method_name} did not have enough hosts to test" previous_hosts = hosts.dup options[:platform_tag_confines] = [ @@ -35,7 +35,7 @@ # is being raised confirms that a lower number of hosts are coming out of # the confine (0) than came in (>0, according to our pre-condition assertion) else - assert hosts.length() < previous_hosts.length(), "#{pstc_method_name} did not change hosts array" + assert hosts.length < previous_hosts.length, "#{pstc_method_name} did not change hosts array" end # cleanup diff --git a/lib/beaker/host/aix/exec.rb b/lib/beaker/host/aix/exec.rb index 512cd213d1..3117078f37 100644 --- a/lib/beaker/host/aix/exec.rb +++ b/lib/beaker/host/aix/exec.rb @@ -24,6 +24,6 @@ def ssh_service_restart # (from {#ssh_service_restart}). def ssh_permit_user_environment exec(Beaker::Command.new("echo '\nPermitUserEnvironment yes' >> /etc/ssh/sshd_config")) - ssh_service_restart() + ssh_service_restart end end diff --git a/lib/beaker/host/mac/exec.rb b/lib/beaker/host/mac/exec.rb index 7a8bd1eb78..5b9bc79fd1 100644 --- a/lib/beaker/host/mac/exec.rb +++ b/lib/beaker/host/mac/exec.rb @@ -24,7 +24,7 @@ def ssh_permit_user_environment ssh_config_file = '/private/etc/ssh/sshd_config' if /^osx-/.match?(self['platform']) exec(Beaker::Command.new("echo '\nPermitUserEnvironment yes' >> #{ssh_config_file}")) - ssh_service_restart() + ssh_service_restart end #  Checks if selinux is enabled diff --git a/lib/beaker/host/pswindows/file.rb b/lib/beaker/host/pswindows/file.rb index 765ee8b229..aded8e0dfd 100644 --- a/lib/beaker/host/pswindows/file.rb +++ b/lib/beaker/host/pswindows/file.rb @@ -3,13 +3,13 @@ module PSWindows::File def tmpfile(_name = '') result = exec(powershell('[System.IO.Path]::GetTempFileName()')) - result.stdout.chomp() + result.stdout.chomp end def tmpdir(name = '') - tmp_path = exec(powershell('[System.IO.Path]::GetTempPath()')).stdout.chomp() + tmp_path = exec(powershell('[System.IO.Path]::GetTempPath()')).stdout.chomp - name = exec(powershell('[System.IO.Path]::GetRandomFileName()')).stdout.chomp() if name == '' + name = exec(powershell('[System.IO.Path]::GetRandomFileName()')).stdout.chomp if name == '' exec(powershell("New-Item -Path '#{tmp_path}' -Force -Name '#{name}' -ItemType 'directory'")) File.join(tmp_path, name) end diff --git a/lib/beaker/host/unix/exec.rb b/lib/beaker/host/unix/exec.rb index 7f1d8eba17..d3d8894e78 100644 --- a/lib/beaker/host/unix/exec.rb +++ b/lib/beaker/host/unix/exec.rb @@ -303,7 +303,7 @@ def ssh_service_restart def ssh_permit_user_environment case self['platform'] when /debian|ubuntu|cumulus|huaweios|archlinux|el-|centos|fedora|redhat|oracle|scientific|eos|opensuse|sles|solaris/ - directory = tmpdir() + directory = tmpdir exec(Beaker::Command.new("echo 'PermitUserEnvironment yes' | cat - /etc/ssh/sshd_config > #{directory}/sshd_config.permit")) exec(Beaker::Command.new("mv #{directory}/sshd_config.permit /etc/ssh/sshd_config")) exec(Beaker::Command.new("echo '' >/etc/environment")) if /ubuntu-2(0|2).04/.match?(self['platform']) @@ -313,7 +313,7 @@ def ssh_permit_user_environment raise ArgumentError, "Unsupported Platform: '#{self['platform']}'" end - ssh_service_restart() + ssh_service_restart end # Construct the environment string for this command diff --git a/lib/beaker/host/windows/exec.rb b/lib/beaker/host/windows/exec.rb index fe5b39f4a1..702d1d87ae 100644 --- a/lib/beaker/host/windows/exec.rb +++ b/lib/beaker/host/windows/exec.rb @@ -84,7 +84,7 @@ def ssh_service_restart # (from {#ssh_service_restart}). def ssh_permit_user_environment exec(Beaker::Command.new("echo '\nPermitUserEnvironment yes' >> /etc/sshd_config")) - ssh_service_restart() + ssh_service_restart end # Gets the specific prepend commands as needed for this host diff --git a/spec/beaker/cli_spec.rb b/spec/beaker/cli_spec.rb index 95a9be359d..53ee454b23 100644 --- a/spec/beaker/cli_spec.rb +++ b/spec/beaker/cli_spec.rb @@ -134,7 +134,7 @@ module Beaker context 'execute!' do before do - stub_const("Beaker::Logger", double().as_null_object) + stub_const("Beaker::Logger", double.as_null_object) File.open("sample.cfg", "w+") do |file| file.write("HOSTS:\n") file.write(" myhost:\n") diff --git a/spec/beaker/dsl/test_tagging_spec.rb b/spec/beaker/dsl/test_tagging_spec.rb index 0c7d87c0de..195d4d0120 100644 --- a/spec/beaker/dsl/test_tagging_spec.rb +++ b/spec/beaker/dsl/test_tagging_spec.rb @@ -149,13 +149,13 @@ class ClassMixedWithDSLStructure }] internal_hash = confiner.instance_variable_get(:@tag_confine_details_hash) - expect(internal_hash.keys()).to include('tag1') - expect(internal_hash.keys()).to include('tag2') - expect(internal_hash.keys().length()).to be === 2 + expect(internal_hash.keys).to include('tag1') + expect(internal_hash.keys).to include('tag2') + expect(internal_hash.keys.length).to be === 2 tag_reason_hash.each do |tag, reason| tag_array = internal_hash[tag] - expect(tag_array.length()).to be === 1 + expect(tag_array.length).to be === 1 tag_hash = tag_array[0] expect(tag_hash[:platform_regex]).to eql(platform_regex) expect(tag_hash[:log_message]).to match(/#{reason}/) @@ -181,13 +181,13 @@ class ClassMixedWithDSLStructure ] internal_hash = confiner.instance_variable_get(:@tag_confine_details_hash) - expect(internal_hash.keys()).to include('tag1') - expect(internal_hash.keys()).to include('tag2') - expect(internal_hash.keys()).to include('tag3') - expect(internal_hash.keys().length()).to be === 3 + expect(internal_hash.keys).to include('tag1') + expect(internal_hash.keys).to include('tag2') + expect(internal_hash.keys).to include('tag3') + expect(internal_hash.keys.length).to be === 3 shared_tag_array = internal_hash['tag1'] - expect(shared_tag_array.length()).to be === 2 + expect(shared_tag_array.length).to be === 2 platform_el_found = false platform_cisco_found = false @@ -237,7 +237,7 @@ class ClassMixedWithDSLStructure key_combos_to_test << ['tag0', 'tag2'] key_combos_to_test << ['tag1', 'tag4'] key_combos_to_test << ['tag2', 'tag3', 'tag4'] - key_combos_to_test << fake_confine_details_hash.keys() + key_combos_to_test << fake_confine_details_hash.keys before do confiner.instance_variable_set( diff --git a/spec/beaker/host_prebuilt_steps_spec.rb b/spec/beaker/host_prebuilt_steps_spec.rb index a8b16e0dbe..ae52b12e1e 100644 --- a/spec/beaker/host_prebuilt_steps_spec.rb +++ b/spec/beaker/host_prebuilt_steps_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' describe Beaker do - let(:options) { make_opts.merge({ 'logger' => double().as_null_object }) } + let(:options) { make_opts.merge({ 'logger' => double.as_null_object }) } let(:ntpserver_set) { "ntp_server_set" } let(:options_ntp) { make_opts.merge({ 'ntp_server' => ntpserver_set }) } let(:ntpserver) { Beaker::HostPrebuiltSteps::NTPSERVER } diff --git a/spec/beaker/hypervisor/hypervisor_spec.rb b/spec/beaker/hypervisor/hypervisor_spec.rb index 027c21eba8..3b9a094983 100644 --- a/spec/beaker/hypervisor/hypervisor_spec.rb +++ b/spec/beaker/hypervisor/hypervisor_spec.rb @@ -9,11 +9,11 @@ module Beaker it "includes custom hypervisor and call set_ssh_connection_preference" do allow(hypervisor).to receive(:set_ssh_connection_preference).with([], hypervisor) - expect { hypervisor.create('custom_hypervisor', [], make_opts()) }.to raise_error(LoadError, "cannot load such file -- beaker/hypervisor/custom_hypervisor") + expect { hypervisor.create('custom_hypervisor', [], make_opts) }.to raise_error(LoadError, "cannot load such file -- beaker/hypervisor/custom_hypervisor") end it "sets ssh connection preference if connection_preference method is not overwritten" do - hypervisor.create('none', hosts, make_opts()) + hypervisor.create('none', hosts, make_opts) expect(hosts[0][:ssh_connection_preference]).to eq([:ip, :vmhostname, :hostname]) end @@ -31,7 +31,7 @@ module Beaker it "gives highest precedence to preference specified in host file followed by hypervisor" do hosts[0].options[:ssh_preference] = [:set, :in, :hostfile] - hypervisor.create('none', hosts, make_opts()) + hypervisor.create('none', hosts, make_opts) allow(hypervisor).to receive(:connection_preference).and_return([:hypervisor, :pref]) hypervisor.set_ssh_connection_preference(hosts, hypervisor) expect(hosts[0][:ssh_connection_preference]).to eq([:set, :in, :hostfile, :hypervisor, :pref, :ip, :vmhostname, :hostname]) @@ -39,7 +39,7 @@ module Beaker end describe "#configure" do - let(:options) { make_opts.merge({ 'logger' => double().as_null_object }) } + let(:options) { make_opts.merge({ 'logger' => double.as_null_object }) } let(:hypervisor) { described_class.new(hosts, options) } context 'if :timesync option set true on host' do @@ -51,7 +51,7 @@ module Beaker end it 'catches signal exceptions and returns stack trace' do - logger = double() + logger = double hosts[0].options[:timesync] = true allow(logger).to receive(:error) allow(logger).to receive(:pretty_backtrace).and_return("multiline\nstring") @@ -131,8 +131,8 @@ module Beaker it "generates hostname with prefix" do prefix = "testing-prefix-to-test-" options[:host_name_prefix] = prefix - expect(hypervisor.generate_host_name().start_with?(prefix)).to be true - expect(hypervisor.generate_host_name().length - prefix.length >= 15).to be true + expect(hypervisor.generate_host_name.start_with?(prefix)).to be true + expect(hypervisor.generate_host_name.length - prefix.length >= 15).to be true end end end diff --git a/spec/beaker/network_manager_spec.rb b/spec/beaker/network_manager_spec.rb index e22dc8c4e2..3ff3a62621 100644 --- a/spec/beaker/network_manager_spec.rb +++ b/spec/beaker/network_manager_spec.rb @@ -9,7 +9,7 @@ module Beaker end let(:options) do make_opts.merge({ - 'logger' => double().as_null_object, + 'logger' => double.as_null_object, :logger_sut => mock_provisioning_logger, :log_prefix => @log_prefix, :hosts_file => @hosts_file, diff --git a/spec/beaker/options/hosts_file_parser_spec.rb b/spec/beaker/options/hosts_file_parser_spec.rb index 31feb6ba65..9de06af890 100644 --- a/spec/beaker/options/hosts_file_parser_spec.rb +++ b/spec/beaker/options/hosts_file_parser_spec.rb @@ -23,7 +23,7 @@ module Options it "returns empty configuration when no file provided" do FakeFS.deactivate! - expect(parser.parse_hosts_file()).to be === { :HOSTS => {} } + expect(parser.parse_hosts_file).to be === { :HOSTS => {} } end it "raises an error on no file found" do diff --git a/spec/beaker/options/parser_spec.rb b/spec/beaker/options/parser_spec.rb index 58d0ca6e74..46c7134a5e 100644 --- a/spec/beaker/options/parser_spec.rb +++ b/spec/beaker/options/parser_spec.rb @@ -182,12 +182,12 @@ module Options end def mock_out_parsing - presets_obj = double() + presets_obj = double allow(presets_obj).to receive(:presets).and_return(presets) allow(presets_obj).to receive(:env_vars).and_return(env) parser.instance_variable_set(:@presets, presets_obj) - command_line_parser_obj = double() + command_line_parser_obj = double allow(command_line_parser_obj).to receive(:parse).and_return(argv) parser.instance_variable_set(:@command_line_parser, command_line_parser_obj) diff --git a/spec/beaker/subcommand_spec.rb b/spec/beaker/subcommand_spec.rb index 2048812aff..b7c7b92e18 100644 --- a/spec/beaker/subcommand_spec.rb +++ b/spec/beaker/subcommand_spec.rb @@ -134,9 +134,9 @@ module Beaker let(:cli) { subcommand.cli } let(:yaml_store_mock) { double('yaml_store_mock') } let(:host_hash) { { 'mynode.net' => { :name => 'mynode', :platform => Beaker::Platform.new('centos-6-x86_64') } } } - let(:cleaned_hosts) { double() } - let(:yielded_host_hash) { double() } - let(:yielded_host_name) { double() } + let(:cleaned_hosts) { double } + let(:yielded_host_hash) { double } + let(:yielded_host_name) { double } let(:network_manager) { double('network_manager') } let(:hosts) { double('hosts') } let(:hypervisors) { double('hypervisors') } @@ -169,7 +169,7 @@ module Beaker it 'does not allow hosts to be passed' do subcommand.options = { :hosts => "myhost" } - expect { subcommand.provision() }.to raise_error(NotImplementedError) + expect { subcommand.provision }.to raise_error(NotImplementedError) end end @@ -180,7 +180,7 @@ module Beaker allow(subcommand.cli).to receive(:execute!) end - let(:cleaned_hosts) { double() } + let(:cleaned_hosts) { double } let(:host_hash) { { 'mynode.net' => { :name => 'mynode', :platform => Beaker::Platform.new('centos-6-x86_64') } } } let(:yaml_store_mock) { double('yaml_store_mock') } diff --git a/spec/beaker/test_suite_spec.rb b/spec/beaker/test_suite_spec.rb index 3052464838..4ab5651dc5 100644 --- a/spec/beaker/test_suite_spec.rb +++ b/spec/beaker/test_suite_spec.rb @@ -47,14 +47,14 @@ module Beaker end context 'run' do - let(:options) { make_opts.merge({ :logger => double().as_null_object, 'name' => create_files(@files), :log_dated_dir => '.', :xml_dated_dir => '.' }) } + let(:options) { make_opts.merge({ :logger => double.as_null_object, 'name' => create_files(@files), :log_dated_dir => '.', :xml_dated_dir => '.' }) } let(:broken_script) { "raise RuntimeError" } let(:fail_script) { "raise Beaker::DSL::Outcomes::FailTest" } let(:okay_script) { "true" } let(:rb_test) { 'my_ruby_file.rb' } let(:pl_test) { '/my_perl_file.pl' } let(:sh_test) { '/my_shell_file.sh' } - let(:hosts) { make_hosts() } + let(:hosts) { make_hosts } it 'fails fast if fail_mode != :slow and runtime error is raised' do allow(Logger).to receive('new') @@ -115,8 +115,8 @@ module Beaker end describe TestSuiteResult do - let(:options) { make_opts.merge({ :logger => double().as_null_object }) } - let(:hosts) { make_hosts() } + let(:options) { make_opts.merge({ :logger => double.as_null_object }) } + let(:hosts) { make_hosts } let(:testcase1) { Beaker::TestCase.new(hosts, options[:logger], options) } let(:testcase2) { Beaker::TestCase.new(hosts, options[:logger], options) } let(:testcase3) { Beaker::TestCase.new(hosts, options[:logger], options) } @@ -242,7 +242,7 @@ module Beaker describe '#write_junit_xml' do let(:options) do - make_opts.merge({ :logger => double().as_null_object, + make_opts.merge({ :logger => double.as_null_object, 'name' => create_files(@files), :log_dated_dir => '.', :xml_dated_dir => '.', }) @@ -330,8 +330,8 @@ module Beaker describe '#log_path' do let(:sh_test) { '/my_shell_file.sh' } let(:files) { @files ? @files : [sh_test] } - let(:options) { make_opts.merge({ :logger => double().as_null_object, 'name' => create_files(files) }) } - let(:hosts) { make_hosts() } + let(:options) { make_opts.merge({ :logger => double.as_null_object, 'name' => create_files(files) }) } + let(:hosts) { make_hosts } let(:testsuite) { described_class.new('name', hosts, options, Time.now, :stop) } it 'returns the simple joining of the log dir & file as required' do