File tree Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Original file line number Diff line number Diff line change
1
+ require 'spec_helper'
2
+ require 'ronin/wordlists/cli/wordlist_dir_option'
3
+ require 'ronin/wordlists/cli/command'
4
+
5
+ RSpec . describe Ronin ::Wordlists ::CLI ::WordlistDirOption do
6
+ class TestWordlistDirOptionCommand < Ronin ::Wordlists ::CLI ::Command
7
+ include Ronin ::Wordlists ::CLI ::WordlistDirOption
8
+ end
9
+
10
+ let ( :command_class ) { TestWordlistDirOptionCommand }
11
+
12
+ describe '.included' do
13
+ subject { command_class }
14
+
15
+ it 'adds the --wordlist-dir option to the command' do
16
+ expect ( subject . options ) . to include ( :wordlist_dir )
17
+ end
18
+ end
19
+
20
+ describe '#wordlist_dir' do
21
+ subject { command_class . new }
22
+
23
+ context 'when --wordlist-dir is specified' do
24
+ before do
25
+ subject . options [ :wordlist_dir ] = '/path/to/dir'
26
+ end
27
+
28
+ it 'returns a WordlistDir with the specified directory' do
29
+ expect ( subject . wordlist_dir ) . to be_a ( Ronin ::Wordlists ::WordlistDir )
30
+ expect ( subject . wordlist_dir . path ) . to eq ( '/path/to/dir' )
31
+ end
32
+ end
33
+
34
+ context 'when --wordlist-dir is not specified' do
35
+ it 'returns a default CacheDir' do
36
+ expect ( subject . wordlist_dir ) . to be_a ( Ronin ::Wordlists ::CacheDir )
37
+ end
38
+ end
39
+ end
40
+ end
You can’t perform that action at this time.
0 commit comments