Skip to content

Instantly share code, notes, and snippets.

@vinbarnes
Created March 14, 2011 22:15
Show Gist options
  • Select an option

  • Save vinbarnes/869989 to your computer and use it in GitHub Desktop.

Select an option

Save vinbarnes/869989 to your computer and use it in GitHub Desktop.
diff --git a/spec/wd_command_spec.rb b/spec/wd_command_spec.rb
index ef97107..9ddbb81 100644
--- a/spec/wd_command_spec.rb
+++ b/spec/wd_command_spec.rb
@@ -2,7 +2,13 @@ require File.dirname(__FILE__) + '/spec_helper.rb'
require 'rake'
def run_command
- eval File.read(File.join(File.dirname(__FILE__), *%w[.. bin wd]))
+ cmd_path = File.expand_path(File.join(File.dirname(__FILE__), *%w[.. bin wd]))
+ path = File.expand_path(File.dirname(cmd_path))
+ file = File.read(cmd_path)
+
+ Dir.chdir(path) do |path|
+ eval(file)
+ end
end
describe 'wd command' do
@@ -26,6 +32,25 @@ describe 'wd command' do
end
end
+ describe 'when --version argument is specified' do
+ before do
+ Object.send(:remove_const, :ARGV)
+ ARGV = ['--version']
+ end
+
+ it 'should fail with SystemExit' do
+ lambda { run_command }.should.raise(SystemExit)
+ end
+
+ it 'should exit successfully' do
+ begin
+ run_command
+ rescue SystemExit => e
+ e.success?.should == true
+ end
+ end
+ end
+
describe "when the 'setup' command is specified" do
before do
Object.send(:remove_const, :ARGV)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment