From c23dbb79af3bc95d3f7f6ee690119a80bb55ccff Mon Sep 17 00:00:00 2001 From: "R. Tyler Croy" Date: Tue, 21 Feb 2012 17:27:15 -0800 Subject: [PATCH] Provide a useful error if `foreman check` fails to find a Procfile Fixes #152 --- lib/foreman/cli.rb | 1 + spec/foreman/cli_spec.rb | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/lib/foreman/cli.rb b/lib/foreman/cli.rb index 4f21a34..f7dc59b 100644 --- a/lib/foreman/cli.rb +++ b/lib/foreman/cli.rb @@ -54,6 +54,7 @@ class Foreman::CLI < Thor desc "check", "Validate your application's Procfile" def check + check_procfile! error "no processes defined" unless engine.procfile.entries.length > 0 puts "valid procfile detected (#{engine.procfile.process_names.join(', ')})" end diff --git a/spec/foreman/cli_spec.rb b/spec/foreman/cli_spec.rb index 100e020..405b8a2 100644 --- a/spec/foreman/cli_spec.rb +++ b/spec/foreman/cli_spec.rb @@ -120,6 +120,14 @@ describe "Foreman::CLI", :fakefs do end end end + + describe "without a Procfile" do + it "displays an error" do + mock_error(subject, "Procfile does not exist.") do + subject.check + end + end + end end describe "run" do