diff options
author | snehaldwivedi <sdwivedi@msystechnologies.com> | 2021-10-28 02:18:01 -0700 |
---|---|---|
committer | snehaldwivedi <sdwivedi@msystechnologies.com> | 2021-11-01 23:56:51 -0700 |
commit | e677f67853fde238206c2f96b3770fc3af81f4e3 (patch) | |
tree | bc54f58f469ede79f2ce5f88274cf5841f388851 /spec/unit | |
parent | 9110f7e9b1dc6e9d9406cc148fb3becc90d2abd7 (diff) | |
download | chef-e677f67853fde238206c2f96b3770fc3af81f4e3.tar.gz |
Moved rspec for base.rb and added integration test
Signed-off-by: snehaldwivedi <sdwivedi@msystechnologies.com>
Diffstat (limited to 'spec/unit')
-rw-r--r-- | spec/unit/application/base_spec.rb | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/spec/unit/application/base_spec.rb b/spec/unit/application/base_spec.rb new file mode 100644 index 0000000000..a3a794871d --- /dev/null +++ b/spec/unit/application/base_spec.rb @@ -0,0 +1,36 @@ +require "spec_helper" + +describe Chef::Application::Base, "setup_application" do + let(:validation_path) { "" } + + context "when validation key is supplied" do + before do + @app = Chef::Application::Base.new + tempfile = Tempfile.new(validation_path) + tempfile.write "string" + tempfile.close + @path = tempfile.path + Chef::Config.validation_key = @path + end + + context "when key is in current directory" do + it "should find with full path of validation_key" do + validation_path = "validation.pem" + expect(Chef::Config.validation_key).to eql(@path) + end + end + + context "when path is given" do + validation_path = "/tmp/validation.pem" + it "should find validation_key" do + expect(Chef::Config.validation_key).to eql(@path) + end + end + end + + context "when validation key is not supplied" do + it "should return full path for validation_key" do + expect(Chef::Config.validation_key).to eql("/etc/chef/validation.pem") + end + end +end |