File: content_description_field_spec.rb

package info (click to toggle)
ruby-mail 2.6.1%2Bdfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 4,092 kB
  • ctags: 1,281
  • sloc: ruby: 43,919; makefile: 2
file content (39 lines) | stat: -rw-r--r-- 1,354 bytes parent folder | download | duplicates (2)
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
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
      doing { Mail::ContentDescriptionField.new("Content-Description: This is a description") }.should_not raise_error
    end

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

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

  end

end