File: content_description_field_spec.rb

package info (click to toggle)
ruby-mail 2.6.4%2Bdfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 4,256 kB
  • ctags: 1,327
  • sloc: ruby: 44,678; makefile: 3
file content (40 lines) | stat: -rw-r--r-- 1,397 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# frozen_string_literal: true
require 'spec_helper'

describe Mail::ContentDescriptionField do
  # Content-Description Header Field
  #
  # The ability to associate some descriptive information with a given
  # body is often desirable.  For example, it may be useful to mark an
  # "image" body as "a picture of the Space Shuttle Endeavor."  Such text
  # may be placed in the Content-Description header field.  This header
  # field is always optional.
  #
  #   description := "Content-Description" ":" *text
  #
  # The description is presumed to be given in the US-ASCII character
  # set, although the mechanism specified in RFC 2047 may be used for
  # non-US-ASCII Content-Description values.
  #
  
  describe "initialization" do

    it "should initialize" do
      expect { Mail::ContentDescriptionField.new("Content-Description: This is a description") }.not_to raise_error
    end

    it "should accept a string with the field name" do
      t = Mail::ContentDescriptionField.new('Content-Description: This is a description')
      expect(t.name).to eq 'Content-Description'
      expect(t.value).to eq 'This is a description'
    end

    it "should accept a string without the field name" do
      t = Mail::ContentDescriptionField.new('This is a description')
      expect(t.name).to eq 'Content-Description'
      expect(t.value).to eq 'This is a description'
    end

  end

end