diff options
author | Claire McQuin <claire@getchef.com> | 2014-10-29 15:14:22 -0700 |
---|---|---|
committer | Claire McQuin <claire@getchef.com> | 2014-10-29 15:59:04 -0700 |
commit | 5fed7a65a2f024d964ecf2de1bcf2911cf8a600c (patch) | |
tree | 14cc6968e4fe4fd2485c0211088b25c645a80a4b /spec/unit/config_fetcher_spec.rb | |
parent | b92c309b0f1aa0837f76ab89d6c81c36076ceca9 (diff) | |
download | chef-5fed7a65a2f024d964ecf2de1bcf2911cf8a600c.tar.gz |
Update to RSpec 3.
Diffstat (limited to 'spec/unit/config_fetcher_spec.rb')
-rw-r--r-- | spec/unit/config_fetcher_spec.rb | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/spec/unit/config_fetcher_spec.rb b/spec/unit/config_fetcher_spec.rb index 31787a0909..1b4a4903a8 100644 --- a/spec/unit/config_fetcher_spec.rb +++ b/spec/unit/config_fetcher_spec.rb @@ -16,10 +16,10 @@ describe Chef::ConfigFetcher do let(:config_content) { "# The client.rb content" } it "reads the file from disk" do - ::File.should_receive(:read). + expect(::File).to receive(:read). with(config_location). and_return(config_content) - fetcher.read_config.should == config_content + expect(fetcher.read_config).to eq(config_content) end context "and consuming JSON" do @@ -28,11 +28,11 @@ describe Chef::ConfigFetcher do it "returns the parsed JSON" do - ::File.should_receive(:read). + expect(::File).to receive(:read). with(config_location). and_return(valid_json) - fetcher.fetch_json.should == {"a" => "b"} + expect(fetcher.fetch_json).to eq({"a" => "b"}) end context "and the JSON is invalid" do @@ -40,11 +40,11 @@ describe Chef::ConfigFetcher do it "reports the JSON error" do - ::File.should_receive(:read). + expect(::File).to receive(:read). with(config_location). and_return(invalid_json) - Chef::Application.should_receive(:fatal!). + expect(Chef::Application).to receive(:fatal!). with(invalid_json_error_regex, 2) fetcher.fetch_json end @@ -59,32 +59,32 @@ describe Chef::ConfigFetcher do let(:config_content) { "# The client.rb content" } before do - Chef::HTTP::Simple.should_receive(:new). + expect(Chef::HTTP::Simple).to receive(:new). with(config_location). and_return(http) end it "reads the file over HTTP" do - http.should_receive(:get). + expect(http).to receive(:get). with("").and_return(config_content) - fetcher.read_config.should == config_content + expect(fetcher.read_config).to eq(config_content) end context "and consuming JSON" do let(:config_location) { "https://example.com/foo.json" } it "fetches the file and parses it" do - http.should_receive(:get). + expect(http).to receive(:get). with("").and_return(valid_json) - fetcher.fetch_json.should == {"a" => "b"} + expect(fetcher.fetch_json).to eq({"a" => "b"}) end context "and the JSON is invalid" do it "reports the JSON error" do - http.should_receive(:get). + expect(http).to receive(:get). with("").and_return(invalid_json) - Chef::Application.should_receive(:fatal!). + expect(Chef::Application).to receive(:fatal!). with(invalid_json_error_regex, 2) fetcher.fetch_json end |