Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/spec/lib/rex/proto/mms/client_spec.rb
Views: 11788
# -*- coding: binary -*-1require 'spec_helper'23RSpec.describe Rex::Proto::Mms::Client do45let(:phone_numbers) { ['1112223333'] }67let(:message) { 'message' }89let(:attachment) { 'file.jpg' }1011let(:file_content) { 'content' }1213let(:subject) { 'subject' }1415let(:ctype) { 'ctype' }1617let(:carrier) { :verizon }1819let(:smtp_server) {20Rex::Proto::Mms::Model::Smtp.new(21address: 'example.com',22port: 25,23username: 'username',24password: 'password'25)26}2728subject do29Rex::Proto::Mms::Client.new(30carrier: carrier,31smtp_server: smtp_server32)33end3435describe '#initialize' do36it 'sets carrier' do37expect(subject.carrier).to eq(carrier)38end3940it 'sets smtp server' do41expect(subject.smtp_server).to eq(smtp_server)42end43end4445describe '#send_mms_to_phones' do46before(:each) do47smtp = Net::SMTP.new(smtp_server.address, smtp_server.port)48allow(smtp).to receive(:start).and_yield49allow(smtp).to receive(:send_message) { |args| @sent_message = args }50allow(Net::SMTP).to receive(:new).and_return(smtp)51allow(File).to receive(:read).and_return(file_content)52end5354it 'sends an mms message' do55subject.send_mms_to_phones(phone_numbers, subject, message, attachment, ctype)56expect(@sent_message).to include('MIME-Version: 1.0')57end58end5960end616263