diff options
Diffstat (limited to 'spec/unit/knife/client_create_spec.rb')
-rw-r--r-- | spec/unit/knife/client_create_spec.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/unit/knife/client_create_spec.rb b/spec/unit/knife/client_create_spec.rb index d7d108658e..043dad71e7 100644 --- a/spec/unit/knife/client_create_spec.rb +++ b/spec/unit/knife/client_create_spec.rb @@ -166,6 +166,20 @@ describe Chef::Knife::ClientCreate do expect(client.validator).to be_truthy end end + + describe "with -f or --file when dir or file is not writable" do + it "when the directory is not writable" do + knife.config[:file] = "example/client1.pem" + expect(knife.ui).to receive(:fatal).with("Dir example is not writable. Check permissions.") + expect { knife.run }.to raise_error(SystemExit) + end + + it "when the file is not writable" do + knife.config[:file] = "test/client1.pem" + expect(knife.ui).to receive(:fatal).with("File test/client1.pem is not writable. Check permissions.") + expect { knife.run }.to raise_error(SystemExit) + end + end end end end |