forked from turboladen/tailor
-
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.
Disable max-code-lines* at cmd line, refs turboladen#117.
- Loading branch information
Andrew Crump
committed
Aug 12, 2013
1 parent
1434435
commit 0465e42
Showing
4 changed files
with
25 additions
and
19 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,27 @@ | ||
require 'spec_helper' | ||
require 'tailor/cli/options' | ||
|
||
class Tailor::CLI | ||
describe Options do | ||
describe "#parse!" do | ||
it "allows trailing newlines to be set to a number of lines" do | ||
options = Options.parse!(['--trailing-newlines', '1']) | ||
expect(options.style[:trailing_newlines]).to eql 1 | ||
end | ||
it "allows trailing newlines to be disabled with false" do | ||
options = Options.parse!(['--trailing-newlines', 'false']) | ||
expect(options.style[:trailing_newlines]).to eql false | ||
end | ||
it "allows trailing newlines to be disabled with off" do | ||
options = Options.parse!(['--trailing-newlines', 'off']) | ||
expect(options.style[:trailing_newlines]).to eql false | ||
module OptionHelpers | ||
def cli_option(name) | ||
"--#{name.to_s.gsub('_', '-')}" | ||
end | ||
def option_value(name, value) | ||
options = Tailor::CLI::Options.parse!([cli_option(name), value]) | ||
options.style[name] | ||
end | ||
end | ||
|
||
describe Tailor::CLI::Options do | ||
include OptionHelpers | ||
describe "#parse!" do | ||
[ | ||
:max_code_lines_in_class, | ||
:max_code_lines_in_method, | ||
:trailing_newlines | ||
].each do |o| | ||
it { expect(option_value(o, '1')).to eq 1 } | ||
it { expect(option_value(o, 'false')).to eq false } | ||
it { expect(option_value(o, 'off')).to eq false } | ||
end | ||
end | ||
end | ||
end |