diff options
author | tylercloke <tylercloke@gmail.com> | 2015-04-29 16:04:50 -0700 |
---|---|---|
committer | tylercloke <tylercloke@gmail.com> | 2015-04-30 09:56:59 -0700 |
commit | 3d11fd861949c31096bc60e56914f74447bc604b (patch) | |
tree | 244af6eca09cd53d135459039131f596c4705a3d /spec/unit/key_spec.rb | |
parent | 75cb417e2edbf21427d778b4675c806bdb312b3f (diff) | |
download | chef-3d11fd861949c31096bc60e56914f74447bc604b.tar.gz |
Fixed a bug where create_key would conflict with public_key in hash returned from server on update.
Diffstat (limited to 'spec/unit/key_spec.rb')
-rw-r--r-- | spec/unit/key_spec.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/unit/key_spec.rb b/spec/unit/key_spec.rb index 6c631e200a..94ebbf6ae8 100644 --- a/spec/unit/key_spec.rb +++ b/spec/unit/key_spec.rb @@ -527,6 +527,28 @@ EOS key.update("old_name") end end + + context "when the server returns a public_key and create_key is true" do + before do + key.name "key_name" + key.create_key true + allow(rest).to receive(:put_rest).with(url, key.to_hash).and_return({ + "key" => "key_name", + "public_key" => public_key_string + }) + + end + + it "returns a key with public_key populated" do + new_key = key.update + expect(new_key.public_key).to eq(public_key_string) + end + + it "returns a key without create_key set" do + new_key = key.update + expect(new_key.create_key).to be_nil + end + end end context "when updating a user key" do |