|
546 | 546 |
|
547 | 547 | before do |
548 | 548 | connection.connect! |
549 | | - socket = connection.instance_variable_get(:@socket) |
550 | | - max_message_size = connection.send(:max_message_size) |
551 | | - allow(Mongo::Protocol::Reply).to receive(:deserialize).with(socket, max_message_size).and_return(reply) |
552 | 549 | end |
553 | 550 |
|
554 | 551 | context 'when the ismaster response indicates the auth mechanism is :scram' do |
|
564 | 561 | context 'when the server auth mechanism is scram', if: scram_sha_1_enabled? do |
565 | 562 |
|
566 | 563 | it 'uses scram' do |
| 564 | + socket = connection.instance_variable_get(:@socket) |
| 565 | + max_message_size = connection.send(:max_message_size) |
| 566 | + allow(Mongo::Protocol::Reply).to receive(:deserialize).with(socket, max_message_size).and_return(reply) |
567 | 567 | expect(connection.send(:default_mechanism)).to eq(:scram) |
568 | 568 | end |
569 | 569 | end |
570 | 570 |
|
571 | 571 | context 'when the server auth mechanism is the default (mongodb_cr)', unless: scram_sha_1_enabled? do |
572 | 572 |
|
573 | 573 | it 'uses scram' do |
| 574 | + socket = connection.instance_variable_get(:@socket) |
| 575 | + max_message_size = connection.send(:max_message_size) |
| 576 | + allow(Mongo::Protocol::Reply).to receive(:deserialize).with(socket, max_message_size).and_return(reply) |
574 | 577 | expect(connection.send(:default_mechanism)).to eq(:scram) |
575 | 578 | end |
576 | 579 | end |
|
589 | 592 | context 'when the server auth mechanism is scram', if: scram_sha_1_enabled? do |
590 | 593 |
|
591 | 594 | it 'uses scram' do |
| 595 | + socket = connection.instance_variable_get(:@socket) |
| 596 | + max_message_size = connection.send(:max_message_size) |
| 597 | + allow(Mongo::Protocol::Reply).to receive(:deserialize).with(socket, max_message_size).and_return(reply) |
592 | 598 | expect(connection.send(:default_mechanism)).to eq(:scram) |
593 | 599 | end |
594 | 600 | end |
595 | 601 |
|
596 | 602 | context 'when the server auth mechanism is the default (mongodb_cr)', unless: scram_sha_1_enabled? do |
597 | 603 |
|
598 | 604 | it 'uses mongodb_cr' do |
| 605 | + socket = connection.instance_variable_get(:@socket) |
| 606 | + max_message_size = connection.send(:max_message_size) |
| 607 | + allow(Mongo::Protocol::Reply).to receive(:deserialize).with(socket, max_message_size).and_return(reply) |
599 | 608 | expect(connection.send(:default_mechanism)).to eq(:mongodb_cr) |
600 | 609 | end |
601 | 610 | end |
|
0 commit comments