Skip to content

Commit

Permalink
Make deployment name an optional parameter. (#104)
Browse files Browse the repository at this point in the history
* Updated code to make deployment name parameter optional
* Added test for optional deployment name parameter

Signed-off-by: Rupesh0688 <[email protected]>
Co-authored-by: Vikram Karve <[email protected]>
  • Loading branch information
Rupesh0688 and vkarve-chef authored Jun 27, 2023
1 parent f7b56d8 commit feb9c25
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/vra/deployment_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def hash_parameters

def validate!
missing_params = []
%i{image_mapping flavor_mapping name project_id}.each do |arg|
%i{image_mapping flavor_mapping project_id}.each do |arg|
missing_params << arg if send(arg).nil?
end

Expand Down
11 changes: 11 additions & 0 deletions spec/deployment_request_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,17 @@
expect { request.send(:validate!) }.not_to raise_error(ArgumentError)
end

it "should not return error if deployment name is missing" do
request = described_class.new(client, catalog_id)

request.image_mapping = "Centos Image"
request.flavor_mapping = "Small"
request.version = "1"
request.project_id = "pro-123"

expect { request.send(:validate!) }.not_to raise_error(ArgumentError)
end

context "versions" do
let(:dep_request) do
described_class.new(
Expand Down

0 comments on commit feb9c25

Please sign in to comment.