Sha256: c7b82f2826a359149fc2927613279f56cef981fadba150723f38111447978ad1

Contents?: true

Size: 887 Bytes

Versions: 5

Compression:

Stored size: 887 Bytes

Contents

module BackupDirectoryHelpers
  def message_as_mbox_entry(options)
    from = fixture("connection")[:username]
    subject = options[:subject]
    body = options[:body]
    body_and_headers = <<-EOT
From: #{from}
Subject: #{subject}

#{body}
    EOT

    "From #{from}\n#{body_and_headers}\n"
  end

  def imap_data(uid_validity, uids)
    {
      version: 2,
      uid_validity: uid_validity,
      uids: uids
    }
  end

  def mbox_content(name)
    File.read(mbox_path(name))
  end

  def mbox_path(name)
    File.join(local_backup_path, name + ".mbox")
  end

  def imap_path(name)
    File.join(local_backup_path, name + ".imap")
  end

  def imap_content(name)
    File.read(imap_path(name))
  end

  def imap_parsed(name)
    JSON.parse(imap_content(name), symbolize_names: true)
  end
end

RSpec.configure do |config|
  config.include BackupDirectoryHelpers, type: :feature
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
imap-backup-2.0.0 spec/features/support/backup_directory.rb
imap-backup-2.0.0.rc4 spec/features/support/backup_directory.rb
imap-backup-2.0.0.rc3 spec/features/support/backup_directory.rb
imap-backup-2.0.0.rc2 spec/features/support/backup_directory.rb
imap-backup-2.0.0.rc1 spec/features/support/backup_directory.rb