summaryrefslogtreecommitdiff
path: root/spec/unit/resource_reporter_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/unit/resource_reporter_spec.rb')
-rw-r--r--spec/unit/resource_reporter_spec.rb24
1 files changed, 12 insertions, 12 deletions
diff --git a/spec/unit/resource_reporter_spec.rb b/spec/unit/resource_reporter_spec.rb
index 97a4fe4b30..042b09659c 100644
--- a/spec/unit/resource_reporter_spec.rb
+++ b/spec/unit/resource_reporter_spec.rb
@@ -42,7 +42,7 @@ describe Chef::ResourceReporter do
@new_resource = Chef::Resource::File.new("/tmp/a-file.txt")
@cookbook_name = "monkey"
@new_resource.cookbook_name = @cookbook_name
- @cookbook_version = double("Cookbook::Version", :version => "1.2.3")
+ @cookbook_version = double("Cookbook::Version", version: "1.2.3")
allow(@new_resource).to receive(:cookbook_version).and_return(@cookbook_version)
@current_resource = Chef::Resource::File.new("/tmp/a-file.txt")
@start_time = Time.new
@@ -285,7 +285,7 @@ describe Chef::ResourceReporter do
end
it "resource_command in prepared_run_data should be blank" do
- expect(@first_update_report["after"]).to eq({ :command => "sensitive-resource" })
+ expect(@first_update_report["after"]).to eq({ command: "sensitive-resource" })
end
end
@@ -317,9 +317,9 @@ describe Chef::ResourceReporter do
context "the new_resource name and id are hashes" do
before do
@bad_resource = Chef::Resource::File.new("/tmp/filename_as_hash.txt")
- allow(@bad_resource).to receive(:name).and_return({ :foo => :bar })
- allow(@bad_resource).to receive(:identity).and_return({ :foo => :bar })
- allow(@bad_resource).to receive(:path).and_return({ :foo => :bar })
+ allow(@bad_resource).to receive(:name).and_return({ foo: :bar })
+ allow(@bad_resource).to receive(:identity).and_return({ foo: :bar })
+ allow(@bad_resource).to receive(:path).and_return({ foo: :bar })
@resource_reporter.resource_action_start(@bad_resource, :create)
@resource_reporter.resource_current_state_loaded(@bad_resource, :create, @current_resource)
@resource_reporter.resource_updated(@bad_resource, :create)
@@ -472,7 +472,7 @@ describe Chef::ResourceReporter do
context "when the resource is a RegistryKey with binary data" do
let(:new_resource) do
resource = Chef::Resource::RegistryKey.new('Wubba\Lubba\Dub\Dubs')
- resource.values([ { :name => "rick", :type => :binary, :data => 255.chr * 1 } ])
+ resource.values([ { name: "rick", type: :binary, data: 255.chr * 1 } ])
allow(resource).to receive(:cookbook_name).and_return(@cookbook_name)
allow(resource).to receive(:cookbook_version).and_return(@cookbook_version)
resource
@@ -480,7 +480,7 @@ describe Chef::ResourceReporter do
let(:current_resource) do
resource = Chef::Resource::RegistryKey.new('Wubba\Lubba\Dub\Dubs')
- resource.values([ { :name => "rick", :type => :binary, :data => 255.chr * 1 } ])
+ resource.values([ { name: "rick", type: :binary, data: 255.chr * 1 } ])
resource
end
@@ -617,8 +617,8 @@ describe Chef::ResourceReporter do
@response = Net::HTTPNotFound.new("a response body", "404", "Not Found")
@error = Net::HTTPServerException.new("404 message", @response)
expect(@rest_client).to receive(:post).
- with("reports/nodes/spitfire/runs", { :action => :start, :run_id => @run_id,
- :start_time => @start_time.to_s },
+ with("reports/nodes/spitfire/runs", { action: :start, run_id: @run_id,
+ start_time: @start_time.to_s },
{ "X-Ops-Reporting-Protocol-Version" => Chef::ResourceReporter::PROTOCOL_VERSION }).
and_raise(@error)
end
@@ -647,7 +647,7 @@ describe Chef::ResourceReporter do
@response = Net::HTTPInternalServerError.new("a response body", "500", "Internal Server Error")
@error = Net::HTTPServerException.new("500 message", @response)
expect(@rest_client).to receive(:post).
- with("reports/nodes/spitfire/runs", { :action => :start, :run_id => @run_id, :start_time => @start_time.to_s },
+ with("reports/nodes/spitfire/runs", { action: :start, run_id: @run_id, start_time: @start_time.to_s },
{ "X-Ops-Reporting-Protocol-Version" => Chef::ResourceReporter::PROTOCOL_VERSION }).
and_raise(@error)
end
@@ -677,7 +677,7 @@ describe Chef::ResourceReporter do
@response = Net::HTTPInternalServerError.new("a response body", "500", "Internal Server Error")
@error = Net::HTTPServerException.new("500 message", @response)
expect(@rest_client).to receive(:post).
- with("reports/nodes/spitfire/runs", { :action => :start, :run_id => @run_id, :start_time => @start_time.to_s },
+ with("reports/nodes/spitfire/runs", { action: :start, run_id: @run_id, start_time: @start_time.to_s },
{ "X-Ops-Reporting-Protocol-Version" => Chef::ResourceReporter::PROTOCOL_VERSION }).
and_raise(@error)
end
@@ -698,7 +698,7 @@ describe Chef::ResourceReporter do
before do
response = { "uri" => "https://example.com/reports/nodes/spitfire/runs/@run_id" }
expect(@rest_client).to receive(:post).
- with("reports/nodes/spitfire/runs", { :action => :start, :run_id => @run_id, :start_time => @start_time.to_s },
+ with("reports/nodes/spitfire/runs", { action: :start, run_id: @run_id, start_time: @start_time.to_s },
{ "X-Ops-Reporting-Protocol-Version" => Chef::ResourceReporter::PROTOCOL_VERSION }).
and_return(response)
@resource_reporter.run_started(@run_status)