Sha256: f2a4b278e83eda08b32def4283e0fc0a7133d8df2be3d5184e6cf43d582c5c6e

Contents?: true

Size: 1.33 KB

Versions: 1

Compression:

Stored size: 1.33 KB

Contents

require File.dirname(__FILE__) + '/../../spec_helper'

describe 'core_extensions/string' do
  
  describe "to_crlf" do
    
    it "should change a single LF to CRLF" do
      "\n".to_crlf.should == "\r\n"
    end
    
    it "should change multiple LF to CRLF" do
      "\n\n".to_crlf.should == "\r\n\r\n"
    end
    
    it "should change a single CR to CRLF" do
      "\r".to_crlf.should == "\r\n"
    end
    
    it "should not change CRLF" do
      "\r\n".to_crlf.should == "\r\n"
    end
    
    it "should not change multiple CRLF" do
      "\r\n\r\n".to_crlf.should == "\r\n\r\n"
    end
    
    it "should handle a mix" do
      "\r \n\r\n".to_crlf.should == "\r\n \r\n\r\n"
    end
  end
  
  describe "to_lf" do
    it "should change a single CR to LF" do
      "\r".to_lf.should == "\n"
    end
    
    it "should change multiple LF to CRLF" do
      "\r\r".to_lf.should == "\n\n"
    end
    
    it "should change a single CRLF to LF" do
      "\r\n".to_lf.should == "\n"
    end
    
    it "should change multiple CR to LF" do
      "\r\n\r\n".to_lf.should == "\n\n"
    end
    
    it "should not change LF" do
      "\n".to_lf.should == "\n"
    end
    
    it "should not change multiple CRLF" do
      "\n\n".to_lf.should == "\n\n"
    end
    
    it "should handle a mix" do
      "\r \n\r\n".to_lf.should == "\n \n\n"
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rack-mail_exception-0.0.1 vendor/mail/spec/mail/core_extensions/string_spec.rb