Sha256: dee21ce6c1987fed8fbf663ee5e70431e6f3816006f95f349c39a52ea1b87594

Contents?: true

Size: 790 Bytes

Versions: 3

Compression:

Stored size: 790 Bytes

Contents

require 'spec_helper'
require 'howitzer/gmail_api/client'

RSpec.describe Howitzer::GmailApi::Client do
  let(:gmail_obj) { described_class.new }
  let(:recipient) { 'test@gmail.com' }
  let(:mail_subject) { 'Confirmation instructions' }

  describe '.new' do
    subject { gmail_obj }
    it { expect { subject }.not_to raise_error }
  end

  describe '#find_message' do
    let(:mailbox) { double(Gmail::Mailbox) }
    before do
      allow(mailbox).to receive(:emails).with(
        to: recipient, subject: mail_subject
      ) { [Gmail::Message.new('INBOX', 30)] }
      allow(gmail_obj.instance_variable_get(:@client)).to receive(:inbox) { mailbox }
    end
    it do
      expect(gmail_obj.find_message(recipient, mail_subject)).to be_an_instance_of(Gmail::Message)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
howitzer-2.2.0 spec/unit/lib/gmail_api/client_spec.rb
howitzer-2.1.1 spec/unit/lib/gmail_api/client_spec.rb
howitzer-2.1.0 spec/unit/lib/gmail_api/client_spec.rb