Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.0.0-p0
2.4.2
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ rvm:
- "1.9.2"
- "1.9.3"
- "2.0.0"
- "2.4.2"
- jruby-19mode # JRuby in 1.9 mode
#- rbx-19mode
script: bundle exec rspec spec
1 change: 1 addition & 0 deletions escort.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Gem::Specification.new do |gem|
gem.add_development_dependency('fakefs')
gem.add_development_dependency('rake')
gem.add_development_dependency('travis-lint')
gem.add_development_dependency('pry')

gem.files = `git ls-files`.split($/)
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
Expand Down
21 changes: 11 additions & 10 deletions spec/integration/basic_config_file_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
require 'json'
describe "Escort basic app with config file defined", :integration => true do
include FakeFS::SpecHelpers

Expand Down Expand Up @@ -28,7 +29,7 @@
end
let(:autocreate) {true}
let(:option_string) { "" }
it("should exit with code 0") { expect{ subject }.to exit_with_code(0) }
it("should exit with code 0") { expect(subject).to exit_with_code(0) }
it("should have created a config file in default location") { File.should exist path }
end

Expand All @@ -44,7 +45,7 @@
end
let(:autocreate) {true}
let(:option_string) { "" }
it("should exit with code 0") { expect{ subject }.to exit_with_code(0) }
it("should exit with code 0") { expect(subject).to exit_with_code(0) }
it("should have picked up the existing config file") { result[:command_options][:option1].should == 'hello' }
end
end
Expand All @@ -62,7 +63,7 @@
rescue SystemExit => e
end
end
it("should exit with code 0") { expect{ subject }.to exit_with_code(0) }
it("should exit with code 0") { expect(subject).to exit_with_code(0) }
it("should have picked up the existing config file") { result[:command_options][:option1].should == 'hello' }
end

Expand All @@ -75,7 +76,7 @@
rescue SystemExit => e
end
end
it("should exit with code 0") { expect{ subject }.to exit_with_code(0) }
it("should exit with code 0") { expect(subject).to exit_with_code(0) }
it("should not have created a config file in default location") { File.should_not exist path }
end
end
Expand All @@ -95,31 +96,31 @@

context "--config global option should exist" do
let(:option_string) { "--config=#{path}" }
it("should exit with code 0") { expect{ subject }.to exit_with_code(0) }
it("should exit with code 0") { expect(subject).to exit_with_code(0) }
end

context "escort command should exist" do
let(:option_string) { "escort -h" }
it("should exit with code 0") { expect{ subject }.to exit_with_code(0) }
it("should exit with code 0") { expect(subject).to exit_with_code(0) }

context "--create-config option for escort command should exist" do
let(:option_string) { "escort --create-config=#{path}" }
it("should exit with code 0") { expect{ subject }.to exit_with_code(0) }
it("should exit with code 0") { expect(subject).to exit_with_code(0) }
end

context "--create-default-config option for escort command should exist" do
let(:option_string) { "escort --create-default-config" }
it("should exit with code 0") { expect{ subject }.to exit_with_code(0) }
it("should exit with code 0") { expect(subject).to exit_with_code(0) }
end

context "--update-config option for escort command should exist" do
let(:option_string) { "escort --update-config=#{path}" }
it("should exit with code 0") { expect{ subject }.to exit_with_code(0) }
it("should exit with code 0") { expect(subject).to exit_with_code(0) }
end

context "--update-default-config option for escort command should exist" do
let(:option_string) { "escort --update-default-config" }
it("should exit with code 0") { expect{ subject }.to exit_with_code(0) }
it("should exit with code 0") { expect(subject).to exit_with_code(0) }
end
end
end
Expand Down
6 changes: 3 additions & 3 deletions spec/integration/basic_conflicts_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@

context "when conflicting options supplied" do
let(:option_string) { "--flag1 --flag2" }
it("should exit with code 2 or 3") { expect{ subject }.to exit_with_code(2, 3) }
it("should exit with code 2 or 3") { expect(subject).to exit_with_code(2, 3) }
end

context "when no conflicting options supplied" do
let(:option_string) { "--flag1" }
it("should exit with code 0") { expect{ subject }.to exit_with_code(0) }
it("should exit with code 0") { expect(subject).to exit_with_code(0) }
end

context "when non-existant option in conflict list" do
Expand All @@ -42,6 +42,6 @@
end
end
let(:option_string) { "--flag1" }
it("should exit with code 2") { expect{ subject }.to exit_with_code(2) }
it("should exit with code 2") { expect(subject).to exit_with_code(2) }
end
end
44 changes: 22 additions & 22 deletions spec/integration/basic_depends_on_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
end
end
let(:option_string) { "-f" }
it("it should not exit successfully") { expect{subject}.to_not exit_with_code(0) }
it("it should not exit successfully") { expect(subject).to_not exit_with_code(0) }
end

context "when option dependent on presence of flag" do
Expand All @@ -38,12 +38,12 @@

context "and flag is not present" do
let(:option_string) { "-o foo" }
it("it should not exit successfully") { expect{subject}.to_not exit_with_code(0) }
it("it should not exit successfully") { expect(subject).to_not exit_with_code(0) }
end

context "and flag is present" do
let(:option_string) { "-f -o foo" }
it("it should exit successfully") { expect{subject}.to exit_with_code(0) }
it("it should exit successfully") { expect(subject).to exit_with_code(0) }
end
end

Expand All @@ -69,29 +69,29 @@
context "and other flag has a default value of false" do
context "and other flag is present" do
let(:option_string) { "--flag1 --flag3" }
it("it should exit successfully") { expect{subject}.to exit_with_code(0) }
it("it should exit successfully") { expect(subject).to exit_with_code(0) }
end

context "and other flag is not present" do
let(:option_string) { "--flag3" }
it("it should not exit successfully") { expect{subject}.to_not exit_with_code(0) }
it("it should not exit successfully") { expect(subject).to_not exit_with_code(0) }
end
end

context "and other flag has a default value of true" do
context "and other flag is present" do
let(:option_string) { "--flag2 --flag4" }
it("it should exit successfully") { expect{subject}.to exit_with_code(0) }
it("it should exit successfully") { expect(subject).to exit_with_code(0) }
end

context "and other flag is not present" do
let(:option_string) { "--flag4" }
it("it should exit successfully") { expect{subject}.to exit_with_code(0) }
it("it should exit successfully") { expect(subject).to exit_with_code(0) }
end

context "and other flag negative option is used" do
let(:option_string) { "--no-flag2 --flag4" }
it("it should not exit successfully") { expect{subject}.to_not exit_with_code(0) }
it("it should not exit successfully") { expect(subject).to_not exit_with_code(0) }
end
end
end
Expand All @@ -115,17 +115,17 @@

context "and one of the other options is not present" do
let(:option_string) { "-f --option2=foo" }
it("it should not exit successfully") { expect{subject}.to_not exit_with_code(0) }
it("it should not exit successfully") { expect(subject).to_not exit_with_code(0) }
end

context "and none of the other options are present" do
let(:option_string) { "--option2=foo" }
it("it should not exit successfully") { expect{subject}.to_not exit_with_code(0) }
it("it should not exit successfully") { expect(subject).to_not exit_with_code(0) }
end

context "and all of the other options are present" do
let(:option_string) { "-f -o bar --option2=foo" }
it("it should exit successfully") { expect{subject}.to exit_with_code(0) }
it("it should exit successfully") { expect(subject).to exit_with_code(0) }
end
end

Expand All @@ -148,17 +148,17 @@

context "and other option is supplied with this value" do
let(:option_string) { "-o bar --option2=foo" }
it("it should exit successfully") { expect{subject}.to exit_with_code(0) }
it("it should exit successfully") { expect(subject).to exit_with_code(0) }
end

context "and other option is supplied with different value" do
let(:option_string) { "-o baz --option2=foo" }
it("it should not exit successfully") { expect{subject}.to_not exit_with_code(0) }
it("it should not exit successfully") { expect(subject).to_not exit_with_code(0) }
end

context "and other option is not supplied" do
let(:option_string) { "--option2=foo" }
it("it should not exit successfully") { expect{subject}.to_not exit_with_code(0) }
it("it should not exit successfully") { expect(subject).to_not exit_with_code(0) }
end
end

Expand All @@ -181,17 +181,17 @@

context "and yet another option is not present" do
let(:option_string) { "-o bar --option2=foo" }
it("it should not exit successfully") { expect{subject}.to_not exit_with_code(0) }
it("it should not exit successfully") { expect(subject).to_not exit_with_code(0) }
end

context "and other option has different value" do
let(:option_string) { "-o baz -f --option2=foo" }
it("it should not exit successfully") { expect{subject}.to_not exit_with_code(0) }
it("it should not exit successfully") { expect(subject).to_not exit_with_code(0) }
end

context "and other option has the right value and yet another option is present" do
let(:option_string) { "-o bar -f --option2=foo" }
it("it should exit successfully") { expect{subject}.to exit_with_code(0) }
it("it should exit successfully") { expect(subject).to exit_with_code(0) }
end
end

Expand All @@ -210,7 +210,7 @@
end
end
let(:option_string) { "-o bar" }
it("it should not exit successfully") { expect{subject}.to_not exit_with_code(0) }
it("it should not exit successfully") { expect(subject).to_not exit_with_code(0) }
end

context "when dependency specified for non-existant option" do
Expand All @@ -228,7 +228,7 @@
end
end
let(:option_string) { "-o bar" }
it("it should not exit successfully") { expect{subject}.to_not exit_with_code(0) }
it("it should not exit successfully") { expect(subject).to_not exit_with_code(0) }
end

context "when option dependent on non-existant option" do
Expand All @@ -246,7 +246,7 @@
end
end
let(:option_string) { "-o bar" }
it("it should not exit successfully") { expect{subject}.to_not exit_with_code(0) }
it("it should not exit successfully") { expect(subject).to_not exit_with_code(0) }
end

context "when dependency is specified inline" do
Expand All @@ -264,12 +264,12 @@
end
context "and dependency is satisfied" do
let(:option_string) { "-f -o bar" }
it("it should exit successfully") { expect{subject}.to exit_with_code(0) }
it("it should exit successfully") { expect(subject).to exit_with_code(0) }
end

context "and dependency is not satisfied" do
let(:option_string) { "-o bar" }
it("it should not exit successfully") { expect{subject}.to_not exit_with_code(0) }
it("it should not exit successfully") { expect(subject).to_not exit_with_code(0) }
end
end
end
20 changes: 10 additions & 10 deletions spec/integration/basic_options_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,27 @@

context "when called with empty option string" do
let(:option_string) { "" }
it("should exit with code 0") { expect{ subject }.to exit_with_code(0) }
it("should execute the global action") { expect{subject}.to execute_action_for_command(result, :global) }
it("option1 have its default value in action") { expect{subject}.to execute_action_with_options(result, :option1 => 'option 1') }
it("should exit with code 0") { expect(subject).to exit_with_code(0) }
it("should execute the global action") { expect(subject).to execute_action_for_command(result, :global) }
it("option1 have its default value in action") { expect(subject).to execute_action_with_options(result, :option1 => 'option 1') }
end

context "when called with option string with short code option" do
let(:option_string) { "-o blah" }
it("should exit with code 0") { expect{ subject }.to exit_with_code(0) }
it("should execute the global action") { expect{subject}.to execute_action_for_command(result, :global) }
it("option1 have the value 'blah' in action") { expect{subject}.to execute_action_with_options(result, :option1 => 'blah') }
it("should exit with code 0") { expect(subject).to exit_with_code(0) }
it("should execute the global action") { expect(subject).to execute_action_for_command(result, :global) }
it("option1 have the value 'blah' in action") { expect(subject).to execute_action_with_options(result, :option1 => 'blah') }
end

context "when called with option string with long code option" do
let(:option_string) { "--option1=blah" }
it("should exit with code 0") { expect{ subject }.to exit_with_code(0) }
it("should execute the global action") { expect{subject}.to execute_action_for_command(result, :global) }
it("option1 have the value 'blah' in action") { expect{subject}.to execute_action_with_options(result, :option1 => 'blah') }
it("should exit with code 0") { expect(subject).to exit_with_code(0) }
it("should execute the global action") { expect(subject).to execute_action_for_command(result, :global) }
it("option1 have the value 'blah' in action") { expect(subject).to execute_action_with_options(result, :option1 => 'blah') }
end

context "when called with option string with unknown option" do
let(:option_string) { "-k" }
it("should not exit with code 0") { expect{ subject }.not_to exit_with_code(0) }
it("should not exit with code 0") { expect(subject).not_to exit_with_code(0) }
end
end
6 changes: 3 additions & 3 deletions spec/integration/basic_options_with_multi_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@

context "when called with empty option string" do
let(:option_string) { "" }
it("option1 should be an empty array") { expect{subject}.to execute_action_with_options(result, :option1 => []) }
it("option1 should be an empty array") { expect(subject).to execute_action_with_options(result, :option1 => []) }
end

context "when called with option1 specified once" do
let(:option_string) { "-o blah" }
it("option1 have the value ['blah'] in action") { expect{subject}.to execute_action_with_options(result, :option1 => ['blah']) }
it("option1 have the value ['blah'] in action") { expect(subject).to execute_action_with_options(result, :option1 => ['blah']) }
end

context "when called with option1 specified 3 times" do
let(:option_string) { "-o blah --option1=blah2 -o blah3" }
it("option1 have the value ['blah', 'blah2', 'blah3'] in action") { expect{subject}.to execute_action_with_options(result, :option1 => ['blah', 'blah2', 'blah3']) }
it("option1 have the value ['blah', 'blah2', 'blah3'] in action") { expect(subject).to execute_action_with_options(result, :option1 => ['blah', 'blah2', 'blah3']) }
end
end
14 changes: 7 additions & 7 deletions spec/integration/basic_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,28 @@

context "when called with empty option string" do
let(:option_string) { "" }
it("should exit with code 0") { expect{ subject }.to exit_with_code(0) }
it("should execute the global action") { expect{subject}.to execute_action_for_command(result, :global) }
it("should exit with code 0") { expect(subject).to exit_with_code(0) }
it("should execute the global action") { expect(subject).to execute_action_for_command(result, :global) }
end

context "when called with non-empty option string" do
let(:option_string) { "hello" }
it("exit code should be 0") { expect{ subject }.to exit_with_code(0) }
it("should execute the global action") { expect{subject}.to execute_action_for_command(result, :global) }
it("exit code should be 0") { expect(subject).to exit_with_code(0) }
it("should execute the global action") { expect(subject).to execute_action_for_command(result, :global) }
end

context "gets --help option automatically" do
let(:option_string) { "--help" }
it("exit code should be 0") { expect{ subject }.to exit_with_code(0) }
it("exit code should be 0") { expect(subject).to exit_with_code(0) }
end

context "gets --verbosity option automatically" do
let(:option_string) { "--verbosity=DEBUG" }
it("exit code should be 0") { expect{ subject }.to exit_with_code(0) }
it("exit code should be 0") { expect(subject).to exit_with_code(0) }
end

context "gets --error-output-format option automatically" do
let(:option_string) { "--error-output-format=advanced" }
it("exit code should be 0") { expect{ subject }.to exit_with_code(0) }
it("exit code should be 0") { expect(subject).to exit_with_code(0) }
end
end
Loading