Enable the RSpec/ExpectOutput cop

Signed-off-by: Rémy Coutable <remy@rymai.me>
This commit is contained in:
Rémy Coutable 2017-05-18 18:56:26 +02:00
parent 06b614f9fd
commit bdf5b6adc3
No known key found for this signature in database
GPG key ID: 46DF07E5CD9E96AB
4 changed files with 15 additions and 18 deletions

View file

@ -987,6 +987,9 @@ RSpec/ExampleWording:
RSpec/ExpectActual:
Enabled: true
RSpec/ExpectOutput:
Enabled: true
# Checks the file and folder naming of the spec file.
RSpec/FilePath:
Enabled: true

View file

@ -23,10 +23,6 @@ RSpec/EmptyLineAfterFinalLet:
RSpec/EmptyLineAfterSubject:
Enabled: false
# Offense count: 3
RSpec/ExpectOutput:
Enabled: false
# Offense count: 72
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: implicit, each, example

View file

@ -46,9 +46,7 @@ describe 'bin/changelog' do
it 'parses -h' do
expect do
$stdout = StringIO.new
described_class.parse(%w[foo -h bar])
expect { described_class.parse(%w[foo -h bar]) }.to output.to_stdout
end.to raise_error(SystemExit)
end

View file

@ -84,24 +84,24 @@ describe 'gitlab:gitaly namespace rake task' do
}
allow(Gitlab.config.repositories).to receive(:storages).and_return(config)
orig_stdout = $stdout
$stdout = StringIO.new
header = ''
expected_output = ''
Timecop.freeze do
header = <<~TOML
expected_output = <<~TOML
# Gitaly storage configuration generated from #{Gitlab.config.source} on #{Time.current.to_s(:long)}
# This is in TOML format suitable for use in Gitaly's config.toml file.
[[storage]]
name = "default"
path = "/path/to/default"
[[storage]]
name = "nfs_01"
path = "/path/to/nfs_01"
TOML
run_rake_task('gitlab:gitaly:storage_config')
end
output = $stdout.string
$stdout = orig_stdout
expect { run_rake_task('gitlab:gitaly:storage_config')}.
to output(expected_output).to_stdout
expect(output).to include(header)
parsed_output = TOML.parse(output)
parsed_output = TOML.parse(expected_output)
config.each do |name, params|
expect(parsed_output['storage']).to include({ 'name' => name, 'path' => params['path'] })
end