From 9e50a114a8bf9ec90dae2929ee462e035c50222f Mon Sep 17 00:00:00 2001 From: Sean Porter Date: Tue, 21 Apr 2015 22:06:00 -0700 Subject: [PATCH] [api-default-port] updated validation for api port, there is now a default value --- lib/sensu/settings/validators/api.rb | 2 +- spec/validator_spec.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/sensu/settings/validators/api.rb b/lib/sensu/settings/validators/api.rb index df7682a..a58cf0e 100644 --- a/lib/sensu/settings/validators/api.rb +++ b/lib/sensu/settings/validators/api.rb @@ -21,7 +21,7 @@ def validate_api_authentication(api) # @param api [Hash] sensu api definition. def validate_api(api) if is_a_hash?(api) - must_be_an_integer(api[:port]) || + must_be_an_integer_if_set(api[:port]) || invalid(api, "api port must be an integer") must_be_a_string_if_set(api[:bind]) || invalid(api, "api bind must be a string") diff --git a/spec/validator_spec.rb b/spec/validator_spec.rb index ed56a2f..c46fddd 100644 --- a/spec/validator_spec.rb +++ b/spec/validator_spec.rb @@ -600,7 +600,7 @@ expect(@validator.reset).to eq(1) api = {} @validator.validate_api(api) - expect(@validator.reset).to eq(1) + expect(@validator.reset).to eq(0) api[:port] = true @validator.validate_api(api) expect(@validator.reset).to eq(1)