Sha256: be6450c1488faeafb4ed02ac298e7c706d6e823dfd9462ec90a7a1c0a63971cc

Contents?: true

Size: 866 Bytes

Versions: 18

Compression:

Stored size: 866 Bytes

Contents

require_relative '../../../../lib/sendgrid/helpers/mail/email'
require 'minitest/autorun'

class TestEmail < Minitest::Test

  include SendGrid

  def test_split_email_full_email
    @email = Email.new(email: "Example User <test1@example.com>")
    expected_json = {
        "email"=>"test1@example.com",
        "name"=>"Example User"
    }
    assert_equal @email.to_json, expected_json
  end

  def test_split_email_only_email
    @email = Email.new(email: "test1@example.com")
    expected_json = {
        "email"=>"test1@example.com",
    }
    assert_equal @email.to_json, expected_json
  end

  def test_split_email_name_and_email
    @email = Email.new(name: "Example User", email: "test1@example.com")
    expected_json = {
        "email"=>"test1@example.com",
        "name"=>"Example User"
    }
    assert_equal @email.to_json, expected_json
  end

end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
sendgrid-ruby-6.3.4 test/sendgrid/helpers/mail/test_email.rb
sendgrid-ruby-6.3.3 test/sendgrid/helpers/mail/test_email.rb
sendgrid-ruby-6.3.2 test/sendgrid/helpers/mail/test_email.rb
sendgrid-ruby-6.3.1 test/sendgrid/helpers/mail/test_email.rb
sendgrid-ruby-6.2.1 test/sendgrid/helpers/mail/test_email.rb
sendgrid-ruby-6.2.0 test/sendgrid/helpers/mail/test_email.rb
sendgrid-ruby-6.1.4 test/sendgrid/helpers/mail/test_email.rb
sendgrid-ruby-6.1.3 test/sendgrid/helpers/mail/test_email.rb
sendgrid-ruby-6.1.2 test/sendgrid/helpers/mail/test_email.rb
sendgrid-ruby-6.1.1 test/sendgrid/helpers/mail/test_email.rb
sendgrid-ruby-6.1.0 test/sendgrid/helpers/mail/test_email.rb
sendgrid-ruby-6.0.4 test/sendgrid/helpers/mail/test_email.rb
sendgrid-ruby-6.0.3 test/sendgrid/helpers/mail/test_email.rb
sendgrid-ruby-6.0.2 test/sendgrid/helpers/mail/test_email.rb
sendgrid-ruby-6.0.1 test/sendgrid/helpers/mail/test_email.rb
sendgrid-ruby-6.0.0 test/sendgrid/helpers/mail/test_email.rb
sendgrid-ruby-5.3.0 test/sendgrid/helpers/mail/test_email.rb
sendgrid-ruby-5.2.0 test/sendgrid/helpers/mail/test_email.rb