-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added RSpec examples to test
model_file
and model_name
.
- Loading branch information
1 parent
e044d89
commit 1b34ae5
Showing
18 changed files
with
69 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
require 'spec_helper' | ||
require 'ronin/db/cli/commands/asn' | ||
require_relative 'man_page_example' | ||
require_relative 'model_command_examples' | ||
|
||
describe Ronin::DB::CLI::Commands::Asn do | ||
include_examples "man_page" | ||
include_examples "ModelCommand" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
require 'spec_helper' | ||
require 'ronin/db/cli/commands/certs' | ||
require_relative 'man_page_example' | ||
require_relative 'model_command_examples' | ||
|
||
describe Ronin::DB::CLI::Commands::Certs do | ||
include_examples "man_page" | ||
include_examples "ModelCommand" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
require 'spec_helper' | ||
require 'ronin/db/cli/commands/creds' | ||
require_relative 'man_page_example' | ||
require_relative 'model_command_examples' | ||
|
||
describe Ronin::DB::CLI::Commands::Creds do | ||
include_examples "man_page" | ||
include_examples "ModelCommand" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
require 'spec_helper' | ||
require 'ronin/db/cli/commands/emails' | ||
require_relative 'man_page_example' | ||
require_relative 'model_command_examples' | ||
|
||
describe Ronin::DB::CLI::Commands::Emails do | ||
include_examples "man_page" | ||
include_examples "ModelCommand" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
require 'spec_helper' | ||
require 'ronin/db/cli/commands/hosts' | ||
require_relative 'man_page_example' | ||
require_relative 'model_command_examples' | ||
|
||
describe Ronin::DB::CLI::Commands::Hosts do | ||
include_examples "man_page" | ||
include_examples "ModelCommand" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
require 'spec_helper' | ||
require 'ronin/db/cli/commands/ips' | ||
require_relative 'man_page_example' | ||
require_relative 'model_command_examples' | ||
|
||
describe Ronin::DB::CLI::Commands::Ips do | ||
include_examples "man_page" | ||
include_examples "ModelCommand" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
require 'rspec' | ||
|
||
RSpec.shared_examples_for "ModelCommand" do | ||
describe "model_file" do | ||
subject { described_class } | ||
|
||
it "must define a model_file" do | ||
expect(subject.model_file).to be_kind_of(String) | ||
expect(subject.model_file).to match(%r{\Aronin/db/[a-z0-9_]+\z}) | ||
end | ||
|
||
it "must be a requirable file" do | ||
expect { | ||
require subject.model_file | ||
}.to_not raise_error | ||
end | ||
end | ||
|
||
describe "model_name" do | ||
subject { described_class } | ||
|
||
it "must define a model_name" do | ||
expect(subject.model_name).to be_kind_of(String) | ||
expect(subject.model_name).to match(/\A[A-Z][A-Za-z0-9]+\z/) | ||
end | ||
|
||
it "must be a valid constant within Ronin::DB" do | ||
expect(Ronin::DB.const_defined?(subject.model_name)).to be(true) | ||
end | ||
|
||
it "must be a kind of ActiveRecord::Base class" do | ||
expect(Ronin::DB.const_get(subject.model_name)).to be < ActiveRecord::Base | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
require 'spec_helper' | ||
require 'ronin/db/cli/commands/open_ports' | ||
require_relative 'man_page_example' | ||
require_relative 'model_command_examples' | ||
|
||
describe Ronin::DB::CLI::Commands::OpenPorts do | ||
include_examples "man_page" | ||
include_examples "ModelCommand" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
require 'spec_helper' | ||
require 'ronin/db/cli/commands/oses' | ||
require_relative 'man_page_example' | ||
require_relative 'model_command_examples' | ||
|
||
describe Ronin::DB::CLI::Commands::Oses do | ||
include_examples "man_page" | ||
include_examples "ModelCommand" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
require 'spec_helper' | ||
require 'ronin/db/cli/commands/passwords' | ||
require_relative 'man_page_example' | ||
require_relative 'model_command_examples' | ||
|
||
describe Ronin::DB::CLI::Commands::Passwords do | ||
include_examples "man_page" | ||
include_examples "ModelCommand" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
require 'spec_helper' | ||
require 'ronin/db/cli/commands/people' | ||
require_relative 'man_page_example' | ||
require_relative 'model_command_examples' | ||
|
||
describe Ronin::DB::CLI::Commands::People do | ||
include_examples "man_page" | ||
include_examples "ModelCommand" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
require 'spec_helper' | ||
require 'ronin/db/cli/commands/phone_numbers' | ||
require_relative 'man_page_example' | ||
require_relative 'model_command_examples' | ||
|
||
describe Ronin::DB::CLI::Commands::PhoneNumbers do | ||
include_examples "man_page" | ||
include_examples "ModelCommand" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
require 'spec_helper' | ||
require 'ronin/db/cli/commands/ports' | ||
require_relative 'man_page_example' | ||
require_relative 'model_command_examples' | ||
|
||
describe Ronin::DB::CLI::Commands::Ports do | ||
include_examples "man_page" | ||
include_examples "ModelCommand" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
require 'spec_helper' | ||
require 'ronin/db/cli/commands/services' | ||
require_relative 'man_page_example' | ||
require_relative 'model_command_examples' | ||
|
||
describe Ronin::DB::CLI::Commands::Services do | ||
include_examples "man_page" | ||
include_examples "ModelCommand" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
require 'spec_helper' | ||
require 'ronin/db/cli/commands/software' | ||
require_relative 'man_page_example' | ||
require_relative 'model_command_examples' | ||
|
||
describe Ronin::DB::CLI::Commands::Software do | ||
include_examples "man_page" | ||
include_examples "ModelCommand" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
require 'spec_helper' | ||
require 'ronin/db/cli/commands/street_addresses' | ||
require_relative 'man_page_example' | ||
require_relative 'model_command_examples' | ||
|
||
describe Ronin::DB::CLI::Commands::StreetAddresses do | ||
include_examples "man_page" | ||
include_examples "ModelCommand" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
require 'spec_helper' | ||
require 'ronin/db/cli/commands/urls' | ||
require_relative 'man_page_example' | ||
require_relative 'model_command_examples' | ||
|
||
describe Ronin::DB::CLI::Commands::Urls do | ||
include_examples "man_page" | ||
include_examples "ModelCommand" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters