Sha256: abcc2e376bfd2858f83ad2bc56483bfc7fd78523374f4ff38bd7e941a362ba87

Contents?: true

Size: 1.75 KB

Versions: 25

Compression:

Stored size: 1.75 KB

Contents

require "rails_helper"

describe Dorsale::Email do
  describe "validations" do
    it "should validate :to format" do
      email = described_class.new

      expect(email).to allow_value("user@example.org").for(:to)
      expect(email).to allow_value("user1@example.org,user2@example.org").for(:to)
      expect(email).to allow_value("user1@example.org;user2@example.org").for(:to)
      expect(email).to allow_value("User <user@example.com>").for(:to)
      expect(email).to allow_value("<user@example.com>").for(:to)
      expect(email).to allow_value("User <user@example.com>;user2@example.org").for(:to)

      expect(email).to_not allow_value("user").for(:to)
      expect(email).to_not allow_value("user@example.com>").for(:to)
      expect(email).to_not allow_value("<user@example.com").for(:to)
      expect(email).to_not allow_value("valid@example.com;invalid").for(:to)
    end

    it "should validate :cc format" do
      email = described_class.new

      expect(email).to allow_value("").for(:cc)

      expect(email).to allow_value("user@example.org").for(:cc)
      expect(email).to allow_value("user1@example.org,user2@example.org").for(:cc)
      expect(email).to allow_value("user1@example.org;user2@example.org").for(:cc)
      expect(email).to allow_value("User <user@example.com>").for(:cc)
      expect(email).to allow_value("<user@example.com>").for(:cc)
      expect(email).to allow_value("User <user@example.com>;user2@example.org").for(:cc)

      expect(email).to_not allow_value("user").for(:cc)
      expect(email).to_not allow_value("user@example.com>").for(:cc)
      expect(email).to_not allow_value("<user@example.com").for(:cc)
      expect(email).to_not allow_value("valid@example.com;invalid").for(:to)
    end
  end # describe "validations" do
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
dorsale-4.0.0 spec/models/dorsale/email_spec.rb
dorsale-3.20.0 spec/models/dorsale/email_spec.rb
dorsale-3.19.1 spec/models/dorsale/email_spec.rb
dorsale-3.19.0 spec/models/dorsale/email_spec.rb
dorsale-3.18.0 spec/models/dorsale/email_spec.rb
dorsale-3.17.0 spec/models/dorsale/email_spec.rb
dorsale-3.16.0 spec/models/dorsale/email_spec.rb
dorsale-3.15.0 spec/models/dorsale/email_spec.rb
dorsale-3.14.11 spec/models/dorsale/email_spec.rb
dorsale-3.14.10 spec/models/dorsale/email_spec.rb
dorsale-3.14.9 spec/models/dorsale/email_spec.rb
dorsale-3.14.8 spec/models/dorsale/email_spec.rb
dorsale-3.14.7 spec/models/dorsale/email_spec.rb
dorsale-3.14.6 spec/models/dorsale/email_spec.rb
dorsale-3.14.5 spec/models/dorsale/email_spec.rb
dorsale-3.14.3 spec/models/dorsale/email_spec.rb
dorsale-3.14.2 spec/models/dorsale/email_spec.rb
dorsale-3.14.1 spec/models/dorsale/email_spec.rb
dorsale-3.14.0 spec/models/dorsale/email_spec.rb
dorsale-3.13.0 spec/models/dorsale/email_spec.rb