summaryrefslogtreecommitdiff
path: root/spec/unit/config_fetcher_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/unit/config_fetcher_spec.rb')
-rw-r--r--spec/unit/config_fetcher_spec.rb44
1 files changed, 22 insertions, 22 deletions
diff --git a/spec/unit/config_fetcher_spec.rb b/spec/unit/config_fetcher_spec.rb
index c91b043160..abaea6b2dc 100644
--- a/spec/unit/config_fetcher_spec.rb
+++ b/spec/unit/config_fetcher_spec.rb
@@ -16,9 +16,9 @@ describe Chef::ConfigFetcher do
let(:config_content) { "# The client.rb content" }
it "reads the file from disk" do
- expect(::File).to receive(:read).
- with(config_location).
- and_return(config_content)
+ expect(::File).to receive(:read)
+ .with(config_location)
+ .and_return(config_content)
expect(fetcher.read_config).to eq(config_content)
end
@@ -42,9 +42,9 @@ describe Chef::ConfigFetcher do
let(:config_location) { "/etc/chef/first-boot.json" }
it "returns the parsed JSON" do
- expect(::File).to receive(:read).
- with(config_location).
- and_return(valid_json)
+ expect(::File).to receive(:read)
+ .with(config_location)
+ .and_return(valid_json)
expect(fetcher.fetch_json).to eq({ "a" => "b" })
end
@@ -53,12 +53,12 @@ describe Chef::ConfigFetcher do
it "reports the JSON error" do
- expect(::File).to receive(:read).
- with(config_location).
- and_return(invalid_json)
+ expect(::File).to receive(:read)
+ .with(config_location)
+ .and_return(invalid_json)
- expect(Chef::Application).to receive(:fatal!).
- with(invalid_json_error_regex)
+ expect(Chef::Application).to receive(:fatal!)
+ .with(invalid_json_error_regex)
fetcher.fetch_json
end
end
@@ -78,14 +78,14 @@ describe Chef::ConfigFetcher do
describe "reading the file" do
before do
- expect(Chef::HTTP::Simple).to receive(:new).
- with(config_location).
- and_return(http)
+ expect(Chef::HTTP::Simple).to receive(:new)
+ .with(config_location)
+ .and_return(http)
end
it "reads the file over HTTP" do
- expect(http).to receive(:get).
- with("").and_return(config_content)
+ expect(http).to receive(:get)
+ .with("").and_return(config_content)
expect(fetcher.read_config).to eq(config_content)
end
@@ -93,18 +93,18 @@ describe Chef::ConfigFetcher do
let(:config_location) { "https://example.com/foo.json" }
it "fetches the file and parses it" do
- expect(http).to receive(:get).
- with("").and_return(valid_json)
+ expect(http).to receive(:get)
+ .with("").and_return(valid_json)
expect(fetcher.fetch_json).to eq({ "a" => "b" })
end
context "and the JSON is invalid" do
it "reports the JSON error" do
- expect(http).to receive(:get).
- with("").and_return(invalid_json)
+ expect(http).to receive(:get)
+ .with("").and_return(invalid_json)
- expect(Chef::Application).to receive(:fatal!).
- with(invalid_json_error_regex)
+ expect(Chef::Application).to receive(:fatal!)
+ .with(invalid_json_error_regex)
fetcher.fetch_json
end
end