forked from aeolus-incubator/thor-cli
-
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.
Merge pull request aeolus-incubator#34 from jistr/output_filtering_rev2
Output: select fields you want for listings
- Loading branch information
Showing
6 changed files
with
73 additions
and
2 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
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
require 'aeolus_cli/common_cli' | ||
|
||
describe AeolusCli::CommonCli do | ||
let(:common_cli) { AeolusCli::CommonCli.new() } | ||
|
||
context "#resource_fields" do | ||
context "non-empty fields" do | ||
subject { common_cli.send(:resource_fields, "name,status,is_cool") } | ||
it { should == [:name, :status, :is_cool] } | ||
end | ||
|
||
context "empty fields" do | ||
subject { common_cli.send(:resource_fields, "") } | ||
it do | ||
expect { subject }.to raise_error Thor::MalformattedArgumentError | ||
end | ||
end | ||
|
||
context "nil fields" do | ||
subject { common_cli.send(:resource_fields, nil) } | ||
it { should == nil } | ||
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
require 'aeolus_cli/formatting' | ||
|
||
describe AeolusCli::Formatting do | ||
let(:formatting) { AeolusCli::Formatting } | ||
let(:shell) { double('shell') } | ||
|
||
context ".create_format" do | ||
subject { formatting.create_format(shell, { :format => 'human' }) } | ||
let(:human_format) { double('human format') } | ||
let(:human_format_class) do | ||
double('human format class').tap do |clazz| | ||
clazz.stub(:new).with(shell).and_return(human_format) | ||
end | ||
end | ||
|
||
before do | ||
formatting.should_receive(:require).with("aeolus_cli/formatting/human_format").and_return(true) | ||
formatting.should_receive(:const_get).with("HumanFormat").and_return(human_format_class) | ||
end | ||
|
||
it { should == human_format } | ||
end | ||
end |