mirror of
https://github.com/athityakumar/colorls.git
synced 2024-09-12 05:31:14 +02:00
Add tests for --report flag
This commit is contained in:
parent
c4f3885410
commit
f43c9b9e7e
2 changed files with 18 additions and 7 deletions
|
@ -20,9 +20,9 @@ RSpec.describe ColorLS::Flags do
|
|||
end.not_to output(/((r|-).*(w|-).*(x|-).*){3}/).to_stdout
|
||||
}
|
||||
|
||||
it('does not display hidden files') { expect { subject }.not_to output(/\.hidden-file/).to_stdout }
|
||||
it('does not show a report') { expect { subject }.not_to output(/Found \d+ contents/).to_stdout }
|
||||
it('displays dirs & files alphabetically') { expect { subject }.to output(/a-file.+symlinks.+z-file/m).to_stdout }
|
||||
it('does not display hidden files') { expect { subject }.not_to output(/\.hidden-file/).to_stdout }
|
||||
it('does not show a report') { expect { subject }.not_to output(/(Found \d+ items in total\.)|(Folders: \d+, Files: \d+\.)/).to_stdout }
|
||||
it('displays dirs & files alphabetically') { expect { subject }.to output(/a-file.+symlinks.+z-file/m).to_stdout }
|
||||
|
||||
it 'displays multiple files per line' do
|
||||
allow($stdout).to receive(:tty?).and_return(true)
|
||||
|
@ -352,11 +352,19 @@ RSpec.describe ColorLS::Flags do
|
|||
end
|
||||
end
|
||||
|
||||
context 'with unrecognized files' do
|
||||
let(:args) { ['--report', FIXTURES] }
|
||||
context 'with --report flag' do
|
||||
let(:args) { ['--report', '--report=long', FIXTURES] }
|
||||
|
||||
it 'shows a report with unrecognized files' do
|
||||
expect { subject }.to output(/Unrecognized files\s+: 3/).to_stdout
|
||||
it 'shows a report with recognized and unrecognized files' do
|
||||
expect { subject }.to output(/Recognized files\s+: 3\n.+Unrecognized files\s+: 3/).to_stdout
|
||||
end
|
||||
end
|
||||
|
||||
context 'with --report=short flag' do
|
||||
let(:args) { ['--report=short', FIXTURES] }
|
||||
|
||||
it 'shows a brief report' do
|
||||
expect { subject }.to output(/Folders: \d+, Files: \d+\./).to_stdout
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -34,6 +34,9 @@ OK colorls --color=never
|
|||
OK colorls --color=always
|
||||
OK colorls --tree spec
|
||||
OK colorls --tree=1
|
||||
OK colorls --report
|
||||
OK colorls --report=long
|
||||
OK colorls --report=short
|
||||
|
||||
LC_ALL=C OK colorls spec/fixtures/
|
||||
LC_ALL=C OK colorls --git spec/fixtures/
|
||||
|
|
Loading…
Reference in a new issue