require 'helper' class TestSocaCLI < Test::Unit::TestCase context "Soca::CLI" do context "push" do setup do @response = Typhoeus::Response.new(:code => 201, :headers => "", :body => '{"ok":"true"}') end context "with default env" do should "push with http put" do Soca::Pusher.any_instance.expects(:put!).twice run_cli('push', '--appdir', @test_app_dir) end end end context "init" do setup do run_cli('init', '--appdir', @new_app_dir) end should "generate a config.js" do assert_file(/mapDirectories/, @new_app_dir, 'config.js') end should "generate a .couchapprc" do assert_file(/env/, @new_app_dir, '.couchapprc') end end context "generate" do setup do run_cli('generate', @new_app_dir) end should "generate a config.js" do assert_file(/mapDirectories/, @new_app_dir, 'config.js') end should "generate a .couchapprc" do assert_file(/env/, @new_app_dir, '.couchapprc') end should "generate a Jimfile" do assert_file(/sammy/, @new_app_dir, 'Jimfile') end should "generate a js directory" do assert_directory(@new_app_dir, 'js') end should "generate an index.html" do assert_file(/\