Permalink
Browse files

exit command

  • Loading branch information...
1 parent 8d098f2 commit 2df39413aeaa52e131bf5bdfee406399e567a75c @txus committed Apr 17, 2012
Showing with 42 additions and 0 deletions.
  1. +1 −0 lib/mayl/commands.rb
  2. +25 −0 lib/mayl/commands/exit.rb
  3. +16 −0 test/mayl/commands/exit_test.rb
View
@@ -9,3 +9,4 @@ module Commands
require 'mayl/commands/get'
require 'mayl/commands/edit'
require 'mayl/commands/cd'
+require 'mayl/commands/exit'
View
@@ -0,0 +1,25 @@
+module Mayl
+ module Commands
+ # Public: The Exit command exits the program.
+ #
+ # Example
+ #
+ # command = Exit.new(env)
+ # command.execute
+ #
+ class Exit
+ # Public: Initializes a new Exit command.
+ #
+ # env - the global environment
+ def initialize(env)
+ end
+
+ # Public: Exits the program.
+ #
+ # Returns nothing.
+ def execute
+ exit(0)
+ end
+ end
+ end
+end
@@ -0,0 +1,16 @@
+require 'test_helper'
+
+module Mayl
+ module Commands
+ describe Exit do
+ before do
+ @command = Exit.new(stub)
+ end
+
+ it 'exits the program' do
+ @command.expects(:exit).with(0)
+ @command.execute
+ end
+ end
+ end
+end

0 comments on commit 2df3941

Please sign in to comment.