Permalink
Browse files

add ability to test full comamnd line

  • Loading branch information...
1 parent ba18f7e commit 86e4251840039b180ce3caefc5353be7da0f554a @ddollar ddollar committed Oct 4, 2011
Showing with 19 additions and 0 deletions.
  1. +9 −0 spec/foreman/cli_spec.rb
  2. +10 −0 spec/spec_helper.rb
@@ -26,6 +26,15 @@
end
describe "export" do
+ describe "options" do
+ it "respects --env" do
+ write_procfile
+ write_env("envfile")
+ mock.instance_of(Foreman::Export::Upstart).export("/upstart", { "env" => "envfile" })
+ foreman %{ export upstart /upstart --env envfile }
+ end
+ end
+
describe "with a non-existent Procfile" do
it "prints an error" do
mock_error(subject, "Procfile does not exist.") do
View
@@ -12,6 +12,10 @@ def mock_error(subject, message)
end
end
+def foreman(args)
+ Foreman::CLI.start(args.split(" "))
+end
+
def mock_exit(&block)
block.should raise_error(SystemExit)
end
@@ -33,6 +37,12 @@ def write_procfile(procfile="Procfile")
File.expand_path(procfile)
end
+def write_env(env=".env")
+ File.open(env, "w") do |file|
+ file.puts "FOO=bar"
+ end
+end
+
def load_export_templates_into_fakefs(type)
FakeFS.deactivate!
files = Dir[File.expand_path("../../data/export/#{type}/**", __FILE__)].inject({}) do |hash, file|

0 comments on commit 86e4251

Please sign in to comment.