Sha256: c8b8039605e9576b85a7a4ee2946b26abceb234506a466b85bbd5f38fca38e66

Contents?: true

Size: 981 Bytes

Versions: 3

Compression:

Stored size: 981 Bytes

Contents

describe Email::Provider do
  describe ".for_address" do
    context "with known providers" do
      [
        ["gmail.com", :gmail],
        ["fastmail.fm", :fastmail]
      ].each do |domain, provider|
        it "recognizes #{provider}" do
          address = "foo@#{domain}"
          expect(described_class.for_address(address).provider).to eq(provider)
        end
      end
    end

    context "with unknown providers" do
      it "returns a default provider" do
        result = described_class.for_address("foo@unknown.com").provider
        expect(result).to eq(:default)
      end
    end
  end

  subject { described_class.new(:gmail) }

  describe "#options" do
    it "returns options" do
      expect(subject.options).to be_a(Hash)
    end

    it "forces TLSv1_2" do
      expect(subject.options[:ssl][:ssl_version]).to eq(:TLSv1_2)
    end
  end

  describe "#host" do
    it "returns host" do
      expect(subject.host).to eq("imap.gmail.com")
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
imap-backup-2.2.1 spec/unit/email/provider_spec.rb
imap-backup-2.2.0 spec/unit/email/provider_spec.rb
imap-backup-2.1.1 spec/unit/email/provider_spec.rb