From fefaa8da71dddc473e2c4ec45b670a37afa58fc5 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Wed, 29 Oct 2014 09:49:37 -0700 Subject: [PATCH] pushes/harmony: use to_s.strip.empty? to check if app is set --- plugins/pushes/harmony/config.rb | 2 +- test/unit/plugins/pushes/harmony/config_test.rb | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/plugins/pushes/harmony/config.rb b/plugins/pushes/harmony/config.rb index d9890079e..6698cadec 100644 --- a/plugins/pushes/harmony/config.rb +++ b/plugins/pushes/harmony/config.rb @@ -72,7 +72,7 @@ module VagrantPlugins def validate(machine) errors = _detected_errors - if @app == nil || @app == "" + if @app.to_s.strip.empty? errors << I18n.t("push_harmony.errors.config.app_required") end diff --git a/test/unit/plugins/pushes/harmony/config_test.rb b/test/unit/plugins/pushes/harmony/config_test.rb index 0806156e3..17cd4c1fe 100644 --- a/test/unit/plugins/pushes/harmony/config_test.rb +++ b/test/unit/plugins/pushes/harmony/config_test.rb @@ -50,6 +50,12 @@ describe VagrantPlugins::HarmonyPush::Config do assert_invalid end + it "is invalid if blank" do + subject.app = " " + subject.finalize! + assert_invalid + end + it "is valid if set" do subject.app = "foo/bar" subject.finalize!