require "spec_helper" require "ostruct" describe VideolistingMailer do it 'sends an email' do fake_listing = OpenStruct.new campaign = OpenStruct.new campaign.vpa = "John Doe" campaign.vpa_email = "john@doe.com" campaign.listingcode = "fakelisting" fake_listing.campaign = campaign fake_listing.videocode = "fakelisting-1" videolisting_mail = VideolistingMailer.videolisting_complete(fake_listing).deliver expect(videolisting_mail.to).to include("john@doe.com") expect(ActionMailer::Base.deliveries.empty?).to eq(false) end end