Created
September 27, 2012 05:46
-
-
Save ugisozols/3792397 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/core/lib/refinery/extension_generation.rb b/core/lib/refinery/extension_generation.rb | |
index 1a44565..6e9c83f 100644 | |
--- a/core/lib/refinery/extension_generation.rb | |
+++ b/core/lib/refinery/extension_generation.rb | |
@@ -180,9 +180,7 @@ module Refinery | |
end | |
def exit_with_message!(message) | |
- puts "" | |
- puts message | |
- puts "" | |
+ $stderr.puts "\n#{message}\n" | |
exit 1 | |
end | |
diff --git a/core/spec/lib/generators/refinery/engine/engine_generator_sanity_check_spec.rb b/core/spec/lib/generators/refinery/engine/engine_generator_sanity_check_spec.rb | |
index 7f605c1..f1096ab 100644 | |
--- a/core/spec/lib/generators/refinery/engine/engine_generator_sanity_check_spec.rb | |
+++ b/core/spec/lib/generators/refinery/engine/engine_generator_sanity_check_spec.rb | |
@@ -6,27 +6,33 @@ module Refinery | |
describe EngineGenerator do | |
include GeneratorSpec::TestCase | |
it "exits when no attribute provided" do | |
- lambda { run_generator %w{ car } }.should raise_error(SystemExit) | |
+ lambda { | |
+ $stderr.should_receive(:puts).with("\nYou must specify a name and at least one field.\nFor help, run: rails generate refinery:engine\n") | |
+ run_generator %w{ car } | |
+ }.should raise_error(SystemExit) | |
end | |
it "exits when '--extension' option is used but there is no extension by provided name" do | |
- lambda { run_generator %w{ car title:string --extension nonexistent } }.should raise_error(SystemExit) | |
+ lambda { | |
+ $stderr.should_receive(:puts).with("\nYou can't use '--extension nonexistent' option because extension with name nonexistent doesn't exist.\n") | |
+ run_generator %w{ car title:string --extension nonexistent } | |
+ }.should raise_error(SystemExit) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment