File: version_part_test.rb

package info (click to toggle)
ruby-mail-gpg 0.4.4-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 328 kB
  • sloc: ruby: 2,289; makefile: 6
file content (36 lines) | stat: -rw-r--r-- 1,049 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
require 'test_helper'
require 'mail/gpg/version_part'

class VersionPartTest < MailGpgTestCase
  context 'VersionPart' do

    should 'roundtrip successfully' do
      part = Mail::Gpg::VersionPart.new()
      assert Mail::Gpg::VersionPart.isVersionPart?(part)
    end

    should 'return false for non gpg mime type' do
      part = Mail::Gpg::VersionPart.new()
      part.content_type = 'text/plain'
      assert !Mail::Gpg::VersionPart.isVersionPart?(part)
    end

    should 'return false for empty body' do
      part = Mail::Gpg::VersionPart.new()
      part.body = nil
      assert !Mail::Gpg::VersionPart.isVersionPart?(part)
    end

    should 'return false for foul body' do
      part = Mail::Gpg::VersionPart.new()
      part.body = 'non gpg body'
      assert !Mail::Gpg::VersionPart.isVersionPart?(part)
    end

    should 'return true for body with extra content' do
      part = Mail::Gpg::VersionPart.new()
      part.body = "#{part.body} extra content"
      assert Mail::Gpg::VersionPart.isVersionPart?(part)
    end
  end
end