diff --git a/lib/kamal/secrets.rb b/lib/kamal/secrets.rb index 882ae0eb..7a382f98 100644 --- a/lib/kamal/secrets.rb +++ b/lib/kamal/secrets.rb @@ -17,7 +17,7 @@ def [](key) if secrets_files.present? raise Kamal::ConfigurationError, "Secret '#{key}' not found in #{secrets_files.join(", ")}" else - raise Kamal::ConfigurationError, "Secret '#{key}' not found, cannot find secret files #{secrets_filenames.join(", ")}" + raise Kamal::ConfigurationError, "Secret '#{key}' not found, no secret files (#{secrets_filenames.join(", ")}) provided" end end diff --git a/test/secrets_test.rb b/test/secrets_test.rb index 9cb9d64a..aca9cebe 100644 --- a/test/secrets_test.rb +++ b/test/secrets_test.rb @@ -34,13 +34,15 @@ class SecretsTest < ActiveSupport::TestCase test "no secrets files" do with_test_secrets do - assert_raises(Kamal::ConfigurationError, "Secret 'SECRET' not found, cannot find secret files .kamal/secrets-common, .kamal/secrets") do + error = assert_raises(Kamal::ConfigurationError) do Kamal::Secrets.new["SECRET"] end + assert_equal "Secret 'SECRET' not found, no secret files (.kamal/secrets-common, .kamal/secrets) provided", error.message - assert_raises(Kamal::ConfigurationError, "Secret 'SECRET' not found, cannot find secret files .kamal/secrets-common, .kamal/secrets.dest") do + error = assert_raises(Kamal::ConfigurationError) do Kamal::Secrets.new(destination: "dest")["SECRET"] end + assert_equal "Secret 'SECRET' not found, no secret files (.kamal/secrets-common, .kamal/secrets.dest) provided", error.message end end end