Skip to content

Commit

Permalink
Add spec for List (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
moozzi authored Jan 27, 2024
1 parent a026ca7 commit 12d20fa
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions spec/cli/commands/list_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,42 @@

describe Ronin::Wordlists::CLI::Commands::List do
include_examples "man_page"

describe '#run' do
context 'with given name' do
let(:name) { 'list' }
let(:wordlists) { ['list1', 'list2'] }

it 'must list wordlists matching the specified name' do
expect(subject.wordlist_dir).to receive(:list).with(name).and_return(wordlists)
expect {
subject.run(name)
}.to output(
[
" list1",
" list2",
""
].join($/)
).to_stdout
end
end

context 'witout given name' do
let(:wordlists) { ['wordlist1', 'wordlist2', 'wordlist3'] }

it 'must list all wordlists' do
expect(subject.wordlist_dir).to receive(:list).with(no_args).and_return(wordlists)
expect {
subject.run
}.to output(
[
" wordlist1",
" wordlist2",
" wordlist3",
""
].join($/)
).to_stdout
end
end
end
end

0 comments on commit 12d20fa

Please sign in to comment.