forked from r7kamura/templatecop
-
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.
When a cop raises an exception, RuboCop will swallow it and tell you to use debug mode if you want to see the backtrace. I needed to add this in order to be able to debug the problems which lead to PR r7kamura#5.
- Loading branch information
Showing
5 changed files
with
68 additions
and
3 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,37 @@ | ||
# frozen_string_literal: true | ||
|
||
RSpec.describe Templatecop::Cli do | ||
describe '.call' do | ||
subject(:execute) do | ||
described_class.call( | ||
executable_name: executable_name, | ||
ruby_extractor: ruby_extractor, | ||
implicit_configuration_paths: %w[.acmecop.yml .rubocop.yml], | ||
argv: cli_arguments.unshift(executable_name), | ||
default_configuration_path: File.expand_path('../fixtures/default.yml', __dir__) | ||
) | ||
end | ||
|
||
let(:executable_name) do | ||
'acmecop' | ||
end | ||
|
||
let(:ruby_extractor) do | ||
double(call: []) | ||
end | ||
|
||
context 'with -d CLI flag' do | ||
let(:cli_arguments) do | ||
['-d'] | ||
end | ||
|
||
it 'calls the Rubocop team with debug mode on' do | ||
allow(RuboCop::Cop::Team).to receive(:new) | ||
|
||
execute | ||
|
||
expect(RuboCop::Cop::Team).to have_received(:new).with(a_hash_including(debug: true)) | ||
end | ||
end | ||
end | ||
end |