File tree 5 files changed +41
-0
lines changed
5 files changed +41
-0
lines changed Original file line number Diff line number Diff line change
1
+ source 'http://rubygems.org'
2
+
3
+ gemspec
Original file line number Diff line number Diff line change 3
3
module Overcommit
4
4
class CLI
5
5
include ConsoleMethods
6
+ attr_reader :options
6
7
7
8
def initialize ( arguments = [ ] )
8
9
@arguments = arguments
Original file line number Diff line number Diff line change @@ -20,4 +20,6 @@ Gem::Specification.new do |s|
20
20
s . files = Dir [ 'lib/**/*.rb' ] +
21
21
Dir [ 'bin/**/*' ] +
22
22
Dir [ 'config/*.yml' ]
23
+
24
+ s . add_development_dependency 'rspec'
23
25
end
Original file line number Diff line number Diff line change
1
+ require 'spec_helper'
2
+ require 'overcommit/cli'
3
+
4
+ describe Overcommit ::CLI do
5
+ describe '#parse_arguments' do
6
+ subject do
7
+ cli = described_class . new ( arguments )
8
+ cli . parse_arguments
9
+ cli
10
+ end
11
+
12
+ context 'with no arguments' do
13
+ let ( :arguments ) { [ ] }
14
+
15
+ it 'does not set any targets' do
16
+ subject . options [ :targets ] . should be_empty
17
+ end
18
+ end
19
+
20
+ context 'with excludes' do
21
+ let ( :arguments ) { %w[ --exclude hook_name.first,hook_name/second ] }
22
+
23
+ it 'takes the first part of the name' do
24
+ subject . options [ :excludes ] [ 'hook_name' ] . should_not be_nil
25
+ end
26
+
27
+ it 'creates an array of excludes' do
28
+ subject . options [ :excludes ] [ 'hook_name' ] . should =~ %w[ first second ]
29
+ end
30
+ end
31
+ end
32
+ end
Original file line number Diff line number Diff line change
1
+ require 'overcommit'
2
+
3
+ def exit ( *args ) ; end
You can’t perform that action at this time.
0 commit comments