Sha256: c4020d27d84e2e3450cfb00725f7d6437dc4be6bc7471add311d438229d5a827

Contents?: true

Size: 895 Bytes

Versions: 4

Compression:

Stored size: 895 Bytes

Contents

require 'spec_helper'

describe EmailSpec::MailExt do
  describe "#default_part" do
    it "prefers html_part over text_part" do
      email = Mail.new do
        text_part { body "This is text" }
        html_part { body "This is html" }
      end

      email.default_part.body.to_s.should == "This is html"
    end

    it "returns text_part if html_part not available" do
      email = Mail.new do
        text_part { body "This is text" }
      end

      email.default_part.body.to_s.should == "This is text"
    end

    it "returns the email if not multi-part" do
      email = Mail.new { body "This is the body" }
      email.default_part.body.to_s.should == "This is the body"
    end
  end

  describe "#default_part_body" do
    it "returns default_part.body" do
      email = Mail.new(:body => "hi")
      email.default_part.body.should == email.default_part_body
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
email_spec-1.0.1 spec/email_spec/mail_ext_spec.rb
email_spec-1.2.1 spec/email_spec/mail_ext_spec.rb
email_spec-1.2.0 spec/email_spec/mail_ext_spec.rb
email_spec-1.1.1 spec/email_spec/mail_ext_spec.rb