spec/lib/metasploit/credential/migrator_spec.rb in metasploit-credential-0.14.5 vs spec/lib/metasploit/credential/migrator_spec.rb in metasploit-credential-0.14.6
- old
+ new
@@ -1,9 +1,9 @@
require 'spec_helper'
require 'tempfile'
-describe Metasploit::Credential::Migrator do
+RSpec.describe Metasploit::Credential::Migrator do
include_context 'Mdm::Workspace'
let(:workspace){ FactoryGirl.create(:mdm_workspace) }
let(:host){ FactoryGirl.create(:mdm_host, workspace: workspace)}
let(:service){ FactoryGirl.create(:mdm_service, host: host)}
@@ -60,26 +60,26 @@
before(:each) do
migrator.convert_creds_in_workspace(workspace)
end
it "should be created for each Mdm::Cred" do
- Metasploit::Credential::Public.where(username: cred1.user).should_not be_blank
- Metasploit::Credential::Public.where(username: cred2.user).should_not be_blank
- Metasploit::Credential::Public.where(username: cred3.user).should_not be_blank
+ expect(Metasploit::Credential::Public.where(username: cred1.user)).not_to be_blank
+ expect(Metasploit::Credential::Public.where(username: cred2.user)).not_to be_blank
+ expect(Metasploit::Credential::Public.where(username: cred3.user)).not_to be_blank
end
end
describe "new Privates" do
before(:each) do
migrator.convert_creds_in_workspace(workspace)
end
it "should be created for each Mdm::Cred" do
migrator.convert_creds_in_workspace(workspace)
- Metasploit::Credential::Password.where(data: cred1.pass).should_not be_blank
- Metasploit::Credential::Password.where(data: cred2.pass).should_not be_blank
- Metasploit::Credential::Password.where(data: cred3.pass).should_not be_blank
+ expect(Metasploit::Credential::Password.where(data: cred1.pass)).not_to be_blank
+ expect(Metasploit::Credential::Password.where(data: cred2.pass)).not_to be_blank
+ expect(Metasploit::Credential::Password.where(data: cred3.pass)).not_to be_blank
end
end
end
describe "creating the proper kinds of Private objects" do
@@ -95,11 +95,11 @@
before(:each) do
migrator.convert_creds_in_workspace(cred.service.host.workspace)
end
it 'should create a new NTLMHash in the database' do
- Metasploit::Credential::NTLMHash.where(data: cred.pass).should_not be_blank
+ expect(Metasploit::Credential::NTLMHash.where(data: cred.pass)).not_to be_blank
end
end
describe "when an Mdm::Cred is an SSH key" do
let(:ssh_key_content){ FactoryGirl.build(:metasploit_credential_ssh_key).data }
@@ -124,11 +124,11 @@
before(:each) do
migrator.convert_creds_in_workspace(cred.service.host.workspace)
end
it 'should create a new SSHKey in the database' do
- Metasploit::Credential::SSHKey.where(data: ssh_key_content).should_not be_blank
+ expect(Metasploit::Credential::SSHKey.where(data: ssh_key_content)).not_to be_blank
end
end
context "when Cred#pass just straight up contains the private key" do
let(:cred) do
@@ -142,11 +142,11 @@
before(:each) do
migrator.convert_creds_in_workspace(cred.service.host.workspace)
end
it 'should create a new SSHKey in the database' do
- Metasploit::Credential::SSHKey.where(data: ssh_key_content).should_not be_blank
+ expect(Metasploit::Credential::SSHKey.where(data: ssh_key_content)).not_to be_blank
end
end
context "when Cred#pass is just total garbage" do
let(:cred) do
@@ -160,11 +160,11 @@
before(:each) do
migrator.convert_creds_in_workspace(cred.service.host.workspace)
end
it 'should not create a new SSHKey in the database' do
- Metasploit::Credential::SSHKey.count.should be_zero
+ expect(Metasploit::Credential::SSHKey.count).to be_zero
end
end
end
@@ -180,11 +180,11 @@
before(:each) do
migrator.convert_creds_in_workspace(cred.service.host.workspace)
end
it 'should create a new Password in the database' do
- Metasploit::Credential::Password.where(data: cred.pass).should_not be_blank
+ expect(Metasploit::Credential::Password.where(data: cred.pass)).not_to be_blank
end
end
describe "when an Mdm::Cred is another kind of hash" do
let(:cred) do
@@ -198,10 +198,10 @@
before(:each) do
migrator.convert_creds_in_workspace(cred.service.host.workspace)
end
it 'should create a new NonreplayableHash in the database' do
- Metasploit::Credential::NonreplayableHash.where(data: cred.pass).should_not be_blank
+ expect(Metasploit::Credential::NonreplayableHash.where(data: cred.pass)).not_to be_blank
end
end
end