spec/sonar/cli_spec.rb in sonar-client-0.1.3 vs spec/sonar/cli_spec.rb in sonar-client-0.1.4
- old
+ new
@@ -80,9 +80,32 @@
output = run_command('search fdns 208.118.227.20')
expect(JSON.parse(output)['collection'].size).to be > 1
end
end
end
+
+ describe 'sonar types command' do
+ it 'returns all sonar search types' do
+ output = run_command('types')
+ expect(output).to match(/Certificate to IPs/)
+ end
+ end
+
+ describe 'search all command' do
+ before do
+ allow_any_instance_of(Sonar::Client).to receive(:search).and_return(
+ Sonar::Client.new.search(fdns: '208.118.227.20', exact: true)
+ )
+ end
+ it 'returns results when searching for an IP' do
+ output = run_command('search all 208.118.227.20')
+ expect(output).to match(/rapid7\.com/)
+ end
+ it 'returns results when searching for a domain' do
+ output = run_command('search all rapid7.com')
+ expect(output).to match(/208\.118\.227\.20/)
+ end
+ end
end
def run_command(args)
capture(:stdout) { ret = Sonar::CLI.start(args.split) }.strip
end