forked from thoughtbot/cocaine
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor Runner avilability checking
* Allows tests to run on JRuby * Adds a query method to know if the Runner is available * Uses the query method to determind best_runner * Puts query method on class because it's not instance's responsibility
- Loading branch information
Jon Yurek
committed
Aug 30, 2013
1 parent
4aaf834
commit 20670a4
Showing
13 changed files
with
136 additions
and
95 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,8 @@ | ||
rvm: | ||
- 1.9.2 | ||
- 1.9.3 | ||
- 2.0.0 | ||
- jruby-19mode | ||
|
||
matrix: | ||
allow_failures: | ||
- rvm: jruby-19mode | ||
- rvm: rbx-19mode |
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
# coding: UTF-8 | ||
|
||
module Cocaine | ||
class CommandLineError < StandardError; end | ||
class CommandLineError < StandardError; end | ||
class CommandNotFoundError < CommandLineError; end | ||
class ExitStatusError < CommandLineError; end | ||
class InterpolationError < CommandLineError; end | ||
class ExitStatusError < CommandLineError; end | ||
class InterpolationError < CommandLineError; end | ||
end |
26 changes: 14 additions & 12 deletions
26
spec/cocaine/command_line/runners/backticks_runner_spec.rb
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,22 @@ | ||
require 'spec_helper' | ||
|
||
describe Cocaine::CommandLine::BackticksRunner do | ||
it_behaves_like 'a command that does not block' | ||
if Cocaine::CommandLine::BackticksRunner.supported? | ||
it_behaves_like 'a command that does not block' | ||
|
||
it 'runs the command given' do | ||
subject.call("echo hello").should == "hello\n" | ||
end | ||
it 'runs the command given' do | ||
subject.call("echo hello").should == "hello\n" | ||
end | ||
|
||
it 'modifies the environment and runs the command given' do | ||
subject.call("echo $yes", {"yes" => "no"}).should == "no\n" | ||
end | ||
it 'modifies the environment and runs the command given' do | ||
subject.call("echo $yes", {"yes" => "no"}).should == "no\n" | ||
end | ||
|
||
it 'sets the exitstatus when a command completes' do | ||
subject.call("ruby -e 'exit 0'") | ||
$?.exitstatus.should == 0 | ||
subject.call("ruby -e 'exit 5'") | ||
$?.exitstatus.should == 5 | ||
it 'sets the exitstatus when a command completes' do | ||
subject.call("ruby -e 'exit 0'") | ||
$?.exitstatus.should == 0 | ||
subject.call("ruby -e 'exit 5'") | ||
$?.exitstatus.should == 5 | ||
end | ||
end | ||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,22 @@ | ||
require 'spec_helper' | ||
|
||
describe Cocaine::CommandLine::PopenRunner do | ||
it_behaves_like 'a command that does not block' | ||
if Cocaine::CommandLine::PopenRunner.supported? | ||
it_behaves_like 'a command that does not block' | ||
|
||
it 'runs the command given' do | ||
subject.call("echo hello").should == "hello\n" | ||
end | ||
it 'runs the command given' do | ||
subject.call("echo hello").should == "hello\n" | ||
end | ||
|
||
it 'modifies the environment and runs the command given' do | ||
subject.call("echo $yes", {"yes" => "no"}).should == "no\n" | ||
end | ||
it 'modifies the environment and runs the command given' do | ||
subject.call("echo $yes", {"yes" => "no"}).should == "no\n" | ||
end | ||
|
||
it 'sets the exitstatus when a command completes' do | ||
subject.call("ruby -e 'exit 0'") | ||
$?.exitstatus.should == 0 | ||
subject.call("ruby -e 'exit 5'") | ||
$?.exitstatus.should == 5 | ||
it 'sets the exitstatus when a command completes' do | ||
subject.call("ruby -e 'exit 0'") | ||
$?.exitstatus.should == 0 | ||
subject.call("ruby -e 'exit 5'") | ||
$?.exitstatus.should == 5 | ||
end | ||
end | ||
end | ||
|
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
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
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