Skip to content

Commit ac77020

Browse files
committed
Fixed CLI::Commands::Download#run specs (issue #35).
1 parent 602380c commit ac77020

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

spec/cli/commands/download_spec.rb

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
11
require 'spec_helper'
22
require 'ronin/wordlists/cli/commands/download'
3-
require 'ronin/wordlists/root'
43
require_relative 'man_page_example'
54

65
describe Ronin::Wordlists::CLI::Commands::Download do
76
include_examples "man_page"
87

98
let(:url) { 'http://example.com/wordlist.txt' }
10-
let(:yaml_result) do
11-
{ 'download_wordlist' => { url: url } }
12-
end
139

1410
describe '#run' do
1511
context 'when the url is provided' do
@@ -23,12 +19,22 @@
2319
context 'when the name is provided' do
2420
let(:name) { 'download_wordlist' }
2521

26-
context "and exist in wordlist" do
22+
context "and it exists in the data/wordlists.yml file" do
2723
before do
28-
allow(YAML).to receive(:load_file).and_return(yaml_result)
24+
allow(Ronin::Wordlists::CLI::WordlistIndex).to receive(:load).and_return(
25+
Ronin::Wordlists::CLI::WordlistIndex.new(
26+
{
27+
name => Ronin::Wordlists::CLI::WordlistIndex::Entry.new(
28+
name, url: url,
29+
summary: 'A test wordlist',
30+
categories: %w[test]
31+
)
32+
}
33+
)
34+
)
2935
end
3036

31-
it 'must look up the URL from the wordlists and calls download' do
37+
it 'must look up the URL from the data/wordlists.yml and calls download' do
3238
expect(subject).to receive(:download).with(url)
3339

3440
subject.run(name)

0 commit comments

Comments
 (0)