summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/chef/chef_fs/parallelizer/parallel_enumerable.rb2
-rw-r--r--spec/functional/resource/group_spec.rb8
-rw-r--r--spec/functional/resource/remote_file_spec.rb8
-rw-r--r--spec/spec_helper.rb1
-rw-r--r--spec/support/shared/unit/application_dot_d.rb1
-rw-r--r--spec/unit/chef_fs/parallelizer_spec.rb (renamed from spec/unit/chef_fs/parallelizer.rb)2
6 files changed, 10 insertions, 12 deletions
diff --git a/lib/chef/chef_fs/parallelizer/parallel_enumerable.rb b/lib/chef/chef_fs/parallelizer/parallel_enumerable.rb
index 08fbcd4a41..5fafc5c88f 100644
--- a/lib/chef/chef_fs/parallelizer/parallel_enumerable.rb
+++ b/lib/chef/chef_fs/parallelizer/parallel_enumerable.rb
@@ -145,7 +145,7 @@ class Chef
def each_with_exceptions_unordered
if @each_running
- raise "each() called on parallel enumerable twice simultaneously! Bad mojo"
+ raise "each() called on parallel enumerable twice simultaneously! Bad mojo"
end
@each_running = true
diff --git a/spec/functional/resource/group_spec.rb b/spec/functional/resource/group_spec.rb
index 8fca689e68..7e5b0725c1 100644
--- a/spec/functional/resource/group_spec.rb
+++ b/spec/functional/resource/group_spec.rb
@@ -159,8 +159,10 @@ describe Chef::Resource::Group, :requires_root_or_running_windows do
# excluded_members can only be used when append is set. It is ignored otherwise.
let(:excluded_members) { [] }
+ let(:expected_error_class) { windows? ? ArgumentError : Mixlib::ShellOut::ShellCommandFailed }
+
it "should raise an error" do
- expect { group_resource.run_action(tested_action) }.to raise_error
+ expect { group_resource.run_action(tested_action) }.to raise_error(expected_error_class)
end
end
@@ -169,8 +171,10 @@ describe Chef::Resource::Group, :requires_root_or_running_windows do
group_resource.append(true)
end
+ let(:expected_error_class) { windows? ? Chef::Exceptions::Win32APIError : Mixlib::ShellOut::ShellCommandFailed }
+
it "should raise an error" do
- expect { group_resource.run_action(tested_action) }.to raise_error
+ expect { group_resource.run_action(tested_action) }.to raise_error(expected_error_class)
end
end
end
diff --git a/spec/functional/resource/remote_file_spec.rb b/spec/functional/resource/remote_file_spec.rb
index f4a3d5346d..09e4fdccb4 100644
--- a/spec/functional/resource/remote_file_spec.rb
+++ b/spec/functional/resource/remote_file_spec.rb
@@ -409,13 +409,7 @@ describe Chef::Resource::RemoteFile do
it "should not create the file" do
# This can legitimately raise either Errno::EADDRNOTAVAIL or Errno::ECONNREFUSED
# in different Ruby versions.
- old_value = RSpec::Expectations.configuration.on_potential_false_positives
- RSpec::Expectations.configuration.on_potential_false_positives = :nothing
- begin
- expect { resource.run_action(:create) }.to raise_error
- ensure
- RSpec::Expectations.configuration.on_potential_false_positives = old_value
- end
+ expect { resource.run_action(:create) }.to raise_error(SystemCallError)
expect(File).not_to exist(path)
end
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index fd74a191f1..18a2ae888b 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -116,6 +116,7 @@ RSpec.configure do |config|
config.include(MockShellout::RSpec)
config.filter_run focus: true
config.filter_run_excluding external: true
+ config.raise_on_warning = true
# Explicitly disable :should syntax
# And set max_formatted_output_length to nil to prevent RSpec from doing truncation.
diff --git a/spec/support/shared/unit/application_dot_d.rb b/spec/support/shared/unit/application_dot_d.rb
index 398ff74d8a..a1606b4ff3 100644
--- a/spec/support/shared/unit/application_dot_d.rb
+++ b/spec/support/shared/unit/application_dot_d.rb
@@ -41,7 +41,6 @@ shared_examples_for "an application that loads a dot d" do
expect(IO).to receive(:read).with(Pathname.new("#{client_d_dir}/00-foo.rb").cleanpath.to_s).and_return("foo 0")
expect(IO).to receive(:read).with(Pathname.new("#{client_d_dir}/01-bar.rb").cleanpath.to_s).and_return("bar 0")
expect(IO).to receive(:read).with(Pathname.new("#{client_d_dir}/02-strings.rb").cleanpath.to_s).and_return("strings 0")
- allow(app).to receive(:apply_config).with(anything, Chef::Config.platform_specific_path("/etc/chef/client.rb")).and_call_original.ordered
expect(app).to receive(:apply_config).with("foo 0", Pathname.new("#{client_d_dir}/00-foo.rb").cleanpath.to_s).and_call_original.ordered
expect(app).to receive(:apply_config).with("bar 0", Pathname.new("#{client_d_dir}/01-bar.rb").cleanpath.to_s).and_call_original.ordered
expect(app).to receive(:apply_config).with("strings 0", Pathname.new("#{client_d_dir}/02-strings.rb").cleanpath.to_s).and_call_original.ordered
diff --git a/spec/unit/chef_fs/parallelizer.rb b/spec/unit/chef_fs/parallelizer_spec.rb
index d43e48b7bc..3c675e74fe 100644
--- a/spec/unit/chef_fs/parallelizer.rb
+++ b/spec/unit/chef_fs/parallelizer_spec.rb
@@ -405,7 +405,7 @@ describe Chef::ChefFS::Parallelizer do
expect do
b = enum.enum_for(:each)
b.next
- end.to raise_error
+ end.to raise_error(RuntimeError, "each() called on parallel enumerable twice simultaneously! Bad mojo")
end
end
end