summaryrefslogtreecommitdiff
path: root/spec/unit/chef_fs
diff options
context:
space:
mode:
authorPete Higgins <pete@peterhiggins.org>2020-07-13 17:02:17 -0700
committerPete Higgins <pete@peterhiggins.org>2020-07-13 17:09:32 -0700
commit2732bcc5913a354a5f40a8c9df75307b7e9906b8 (patch)
treeb2bbd98de3f4e984242bf343cd18072f04708db9 /spec/unit/chef_fs
parent7b282172c680d07ddac8e62093b77383206dbf41 (diff)
downloadchef-2732bcc5913a354a5f40a8c9df75307b7e9906b8.tar.gz
Don't allow setting expectations on nil.dont-allow-expectations-on-nil
Signed-off-by: Pete Higgins <pete@peterhiggins.org>
Diffstat (limited to 'spec/unit/chef_fs')
-rw-r--r--spec/unit/chef_fs/file_system/operation_failed_error_spec.rb6
1 files changed, 2 insertions, 4 deletions
diff --git a/spec/unit/chef_fs/file_system/operation_failed_error_spec.rb b/spec/unit/chef_fs/file_system/operation_failed_error_spec.rb
index b34d102068..101a002003 100644
--- a/spec/unit/chef_fs/file_system/operation_failed_error_spec.rb
+++ b/spec/unit/chef_fs/file_system/operation_failed_error_spec.rb
@@ -25,11 +25,9 @@ describe Chef::ChefFS::FileSystem::OperationFailedError do
context "has a cause attribute and HTTP result code is 400" do
it "include error cause" do
- allow_message_expectations_on_nil
response_body = '{"error":["Invalid key test in request body"]}'
- allow(@response).to receive(:code).and_return("400")
- allow(@response).to receive(:body).and_return(response_body)
- exception = Net::HTTPClientException.new("(exception) unauthorized", @response)
+ response = double(:response, code: "400", body: response_body)
+ exception = Net::HTTPClientException.new("(exception) unauthorized", response)
expect do
raise Chef::ChefFS::FileSystem::OperationFailedError.new(:write, self, exception), error_message
end.to raise_error(Chef::ChefFS::FileSystem::OperationFailedError, "#{error_message} cause: #{response_body}")