Skip to content

Commit

Permalink
Added specs for ronin-db creds 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 437e1b0 commit 1c1e4d1
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions spec/cli/commands/creds_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,43 @@
require_relative 'man_page_example'
require_relative 'model_command_examples'

require 'ronin/db/credential'

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

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

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

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

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

describe "--with-password PASSWORD" do
let(:password) { 's3cr3t' }
let(:argv) { ['--with-password', password] }

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

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

0 comments on commit 1c1e4d1

Please sign in to comment.