Skip to content

Commit

Permalink
fixes #8
Browse files Browse the repository at this point in the history
  • Loading branch information
joenas committed Sep 4, 2014
1 parent b8c0561 commit 5afce4a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/preek/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def smell(*files)

desc 'git', 'Run Preek on git changes'
def git
args = git_status.scan(/[ M?]+(.*\.rb)/).flatten
args = git_status.scan(/[ M?]{2} (.*\.rb)/).flatten
smell *args unless args.empty?
end

Expand Down
6 changes: 6 additions & 0 deletions spec/cli_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,12 @@ def test_file(file_name)
Then{}
end

context 'with deleted file' do
Given(:git_output){" M .travis.yml\n M Gemfile\n M lib/random/file.rb\n D ruby.rb\n"}
Given{cli.should_receive(:smell).with('lib/random/file.rb')}
Then{}
end

context 'without ruby file' do
Given(:git_output){" M .travis.yml\n M Gemfile\n M preek.gemspec\n"}
Given{cli.should_not_receive(:smell)}
Expand Down

0 comments on commit 5afce4a

Please sign in to comment.