|
65 | 65 | it { is_expected.to respond_to :proxies }
|
66 | 66 | it { is_expected.to respond_to :stop_on_success }
|
67 | 67 |
|
| 68 | + before do |
| 69 | + creds = double('Metasploit::Framework::CredentialCollection') |
| 70 | + allow(creds).to receive(:pass_file) |
| 71 | + allow(creds).to receive(:username) |
| 72 | + allow(creds).to receive(:password) |
| 73 | + allow(creds).to receive(:user_file) |
| 74 | + allow(creds).to receive(:userpass_file) |
| 75 | + allow(creds).to receive(:prepended_creds).and_return([]) |
| 76 | + allow(creds).to receive(:additional_privates).and_return([]) |
| 77 | + allow(creds).to receive(:additional_publics).and_return(['user']) |
| 78 | + login_scanner.cred_details = creds |
| 79 | + end |
| 80 | + |
68 | 81 | context 'validations' do
|
69 | 82 | context 'port' do
|
70 | 83 |
|
|
160 | 173 |
|
161 | 174 | context 'cred_details' do
|
162 | 175 | it 'is not valid for not set' do
|
| 176 | + creds = double('Metasploit::Framework::CredentialCollection') |
| 177 | + allow(creds).to receive(:pass_file) |
| 178 | + allow(creds).to receive(:username) |
| 179 | + allow(creds).to receive(:password) |
| 180 | + allow(creds).to receive(:user_file) |
| 181 | + allow(creds).to receive(:userpass_file) |
| 182 | + allow(creds).to receive(:prepended_creds).and_return([]) |
| 183 | + allow(creds).to receive(:additional_privates).and_return([]) |
| 184 | + allow(creds).to receive(:additional_publics).and_return([]) |
| 185 | + login_scanner.cred_details = creds |
163 | 186 | expect(login_scanner).to_not be_valid
|
164 | 187 | expect(login_scanner.errors[:cred_details]).to include "can't be blank"
|
165 | 188 | end
|
166 | 189 |
|
167 | 190 | it 'is not valid for a non-array input' do
|
168 |
| - login_scanner.cred_details = rand(10) |
| 191 | + creds = double('Metasploit::Framework::CredentialCollection') |
| 192 | + allow(creds).to receive(:pass_file) |
| 193 | + allow(creds).to receive(:pass_file) |
| 194 | + allow(creds).to receive(:username) |
| 195 | + allow(creds).to receive(:password) |
| 196 | + allow(creds).to receive(:user_file) |
| 197 | + allow(creds).to receive(:userpass_file) |
| 198 | + allow(creds).to receive(:prepended_creds).and_return([]) |
| 199 | + allow(creds).to receive(:additional_privates).and_return([]) |
| 200 | + allow(creds).to receive(:additional_publics).and_return(['user']) |
| 201 | + login_scanner.cred_details = creds |
169 | 202 | expect(login_scanner).to_not be_valid
|
170 | 203 | expect(login_scanner.errors[:cred_details]).to include "must respond to :each"
|
171 | 204 | end
|
|
0 commit comments