spec/reek/cli/application_spec.rb in reek-4.4.1 vs spec/reek/cli/application_spec.rb in reek-4.4.2
- old
+ new
@@ -4,11 +4,11 @@
RSpec.describe Reek::CLI::Application do
describe '#initialize' do
it 'exits with default error code on invalid options' do
call = lambda do
Reek::CLI::Silencer.silently do
- Reek::CLI::Application.new ['--foo']
+ described_class.new ['--foo']
end
end
expect(call).to raise_error(SystemExit) do |error|
expect(error.status).to eq Reek::CLI::Options::DEFAULT_ERROR_EXIT_CODE
end
@@ -20,12 +20,12 @@
end
let(:configuration) { test_configuration_for(CONFIG_PATH.join('with_excluded_paths.reek')) }
describe '#execute' do
- let(:command) { double 'reek_command' }
- let(:app) { Reek::CLI::Application.new [] }
+ let(:command) { instance_double 'Reek::CLI::Command::ReportCommand' }
+ let(:app) { described_class.new [] }
before do
allow(Reek::CLI::Command::ReportCommand).to receive(:new).and_return command
allow(command).to receive(:execute).and_return 'foo'
end
@@ -38,11 +38,11 @@
context 'and input was piped' do
before do
allow_any_instance_of(IO).to receive(:tty?).and_return(false)
end
- it 'should use source form pipe' do
+ it 'uses source form pipe' do
app.execute
expect(Reek::CLI::Command::ReportCommand).to have_received(:new).
with(sources: [$stdin],
configuration: Reek::Configuration::AppConfiguration,
options: Reek::CLI::Options)
@@ -52,48 +52,48 @@
context 'and input was not piped' do
before do
allow_any_instance_of(IO).to receive(:tty?).and_return(true)
end
- it 'should use working directory as source' do
+ it 'uses working directory as source' do
expected_sources = Reek::Source::SourceLocator.new(['.']).sources
app.execute
expect(Reek::CLI::Command::ReportCommand).to have_received(:new).
with(sources: expected_sources,
configuration: Reek::Configuration::AppConfiguration,
options: Reek::CLI::Options)
end
- end
- context 'when source files are excluded through configuration' do
- let(:app) { Reek::CLI::Application.new ['--config', 'some_file.reek'] }
+ context 'when source files are excluded through configuration' do
+ let(:app) { described_class.new ['--config', 'some_file.reek'] }
- before do
- allow(Reek::Configuration::AppConfiguration).
- to receive(:from_path).
- with(Pathname.new('some_file.reek')).
- and_return configuration
- end
+ before do
+ allow(Reek::Configuration::AppConfiguration).
+ to receive(:from_path).
+ with(Pathname.new('some_file.reek')).
+ and_return configuration
+ end
- it 'should use configuration for excluded paths' do
- expected_sources = Reek::Source::SourceLocator.
- new(['.'], configuration: configuration).sources
- expect(expected_sources).not_to include(path_excluded_in_configuration)
+ it 'uses configuration for excluded paths' do
+ expected_sources = Reek::Source::SourceLocator.
+ new(['.'], configuration: configuration).sources
+ expect(expected_sources).not_to include(path_excluded_in_configuration)
- app.execute
+ app.execute
- expect(Reek::CLI::Command::ReportCommand).to have_received(:new).
- with(sources: expected_sources,
- configuration: configuration,
- options: Reek::CLI::Options)
+ expect(Reek::CLI::Command::ReportCommand).to have_received(:new).
+ with(sources: expected_sources,
+ configuration: configuration,
+ options: Reek::CLI::Options)
+ end
end
end
end
context 'when source files given' do
- let(:app) { Reek::CLI::Application.new ['.'] }
+ let(:app) { described_class.new ['.'] }
- it 'should use sources from argv' do
+ it 'uses sources from argv' do
expected_sources = Reek::Source::SourceLocator.new(['.']).sources
app.execute
expect(Reek::CLI::Command::ReportCommand).to have_received(:new).
with(sources: expected_sources,
configuration: Reek::Configuration::AppConfiguration,