Skip to content

Commit 12d20fa

Browse files
authored
Add spec for List (#24)
1 parent a026ca7 commit 12d20fa

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

spec/cli/commands/list_spec.rb

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,42 @@
44

55
describe Ronin::Wordlists::CLI::Commands::List do
66
include_examples "man_page"
7+
8+
describe '#run' do
9+
context 'with given name' do
10+
let(:name) { 'list' }
11+
let(:wordlists) { ['list1', 'list2'] }
12+
13+
it 'must list wordlists matching the specified name' do
14+
expect(subject.wordlist_dir).to receive(:list).with(name).and_return(wordlists)
15+
expect {
16+
subject.run(name)
17+
}.to output(
18+
[
19+
" list1",
20+
" list2",
21+
""
22+
].join($/)
23+
).to_stdout
24+
end
25+
end
26+
27+
context 'witout given name' do
28+
let(:wordlists) { ['wordlist1', 'wordlist2', 'wordlist3'] }
29+
30+
it 'must list all wordlists' do
31+
expect(subject.wordlist_dir).to receive(:list).with(no_args).and_return(wordlists)
32+
expect {
33+
subject.run
34+
}.to output(
35+
[
36+
" wordlist1",
37+
" wordlist2",
38+
" wordlist3",
39+
""
40+
].join($/)
41+
).to_stdout
42+
end
43+
end
44+
end
745
end

0 commit comments

Comments
 (0)