spec/lib/metasploit/credential/migrator_spec.rb in metasploit-credential-1.0.0.pre.rails.pre.4.0 vs spec/lib/metasploit/credential/migrator_spec.rb in metasploit-credential-1.0.0
- 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,20 +60,19 @@
end
it "should be created for each Mdm::Cred" do
expect(Metasploit::Credential::Public.pluck(:username)).to match_array([cred1.user, cred2.user, cred3.user])
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
- expect(Metasploit::Credential::Password.pluck(:data)).to match_array([cred1.pass, cred2.pass, cred3.pass])
+ expect(Metasploit::Credential::Password.pluck(:data)).to match_array([cred1.pass, cred2.pass, cred3.pass])
end
end
end
describe "creating the proper kinds of Private objects" do
@@ -89,11 +88,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 }
@@ -118,11 +117,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
@@ -136,11 +135,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
@@ -154,11 +153,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
@@ -174,11 +173,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
@@ -192,10 +191,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