Sha256: 60c1a924f7e8af4615978aa0aa7e15d5dae1609278a47f3fc31cc7491a5a4eaf

Contents?: true

Size: 942 Bytes

Versions: 18

Compression:

Stored size: 942 Bytes

Contents

# frozen_string_literal: true

require "spec_helper"

describe ValidEmail2::Address do
  describe "#valid?" do
    it "is valid" do
      address = described_class.new("foo@bar123.com")
      expect(address.valid?).to be true
    end

    it "is invalid if email is nil" do
      address = described_class.new(nil)
      expect(address.valid?).to be false
    end

    it "is invalid if email is empty" do
      address = described_class.new(" ")
      expect(address.valid?).to be false
    end

    it "is invalid if domain is missing" do
      address = described_class.new("foo")
      expect(address.valid?).to be false
    end

    it "is invalid if email cannot be parsed" do
      address = described_class.new("<>")
      expect(address.valid?).to be false
    end

    it "is invalid if email contains emoticons" do
      address = described_class.new("foo🙈@gmail.com")
      expect(address.valid?).to be false
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
valid_email2-5.3.0 spec/address_spec.rb
valid_email2-5.2.6 spec/address_spec.rb
valid_email2-5.2.5 spec/address_spec.rb
valid_email2-5.2.4 spec/address_spec.rb
valid_email2-5.2.3 spec/address_spec.rb
valid_email2-5.2.1 spec/address_spec.rb
valid_email2-5.2.0 spec/address_spec.rb
valid_email2-5.1.1 spec/address_spec.rb
valid_email2-5.1.0 spec/address_spec.rb
valid_email2-5.0.5 spec/address_spec.rb
valid_email2-5.0.4 spec/address_spec.rb
valid_email2-5.0.3 spec/address_spec.rb
valid_email2-5.0.2 spec/address_spec.rb
valid_email2-5.0.1 spec/address_spec.rb
valid_email2-5.0.0 spec/address_spec.rb
valid_email2-4.0.6 spec/address_spec.rb
valid_email2-4.0.5 spec/address_spec.rb
valid_email2-4.0.4 spec/address_spec.rb