Skip to content

Commit

Permalink
Added specs for ronin-db emails query methods` (issue #67).
Browse files Browse the repository at this point in the history
  • Loading branch information
postmodern committed Feb 5, 2024
1 parent 1c1e4d1 commit 137a31c
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions spec/cli/commands/emails_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,58 @@
require_relative 'man_page_example'
require_relative 'model_command_examples'

require 'ronin/db/email_address'

describe Ronin::DB::CLI::Commands::Emails do
include_examples "man_page"
include_examples "ModelCommand"

describe "options" do
before { subject.option_parser.parse(argv) }

describe "--with-host HOST" do
let(:host) { 'example.com' }
let(:argv) { ['--with-host', host] }

it "must append :with_host_name and the host to #query_method_calls" do
expect(subject.query_method_calls[-1]).to eq(
[:with_host_name, [host]]
)
end

it "and .with_host_name must be a class method on Ronin::DB::EmailAddress" do
expect(Ronin::DB::EmailAddress).to respond_to(:with_host_name)
end
end

describe "--with-ip IP" do
let(:ip) { '1.2.3.4' }
let(:argv) { ['--with-ip', ip] }

it "must append :with_ip_address and the IP to #query_method_calls" do
expect(subject.query_method_calls[-1]).to eq(
[:with_ip_address, [ip]]
)
end

it "and .with_ip_address must be a class method on Ronin::DB::EmailAddress" do
expect(Ronin::DB::EmailAddress).to respond_to(:with_ip_address)
end
end

describe "--with-user USER" do
let(:user) { 'bob' }
let(:argv) { ['--with-user', user] }

it "must append :with_user_name and the user to #query_method_calls" do
expect(subject.query_method_calls[-1]).to eq(
[:with_user_name, [user]]
)
end

it "and .with_user_name must be a class method on Ronin::DB::EmailAddress" do
expect(Ronin::DB::EmailAddress).to respond_to(:with_user_name)
end
end
end
end

0 comments on commit 137a31c

Please sign in to comment.