Sha256: 69ad127aad827d5accfa9a206140860cef51c0a53d64b4e8ed28abcf77819e00
Contents?: true
Size: 1.26 KB
Versions: 10
Compression:
Stored size: 1.26 KB
Contents
describe 'Base64' do describe 'NSData' do it 'should encode data' do str = 'testing' str_data = str.nsdata str_data.to_base64.should == 'dGVzdGluZw==' end it 'should decode data' do str_data = NSData.from_base64('dGVzdGluZw==') str = NSString.alloc.initWithData(str_data, encoding:NSUTF8StringEncoding) str.should == 'testing' end end describe 'NSString' do it 'should encode data' do 'testing'.to_base64.should == 'dGVzdGluZw==' end it 'should encode data with encoding' do 'testing'.to_base64(NSUnicodeStringEncoding).should == '//50AGUAcwB0AGkAbgBnAA==' end it 'should decode data' do NSString.from_base64('dGVzdGluZw==').should == 'testing' end it 'should decode data with encoding' do NSString.from_base64('//50AGUAcwB0AGkAbgBnAA==', NSUnicodeStringEncoding).should == 'testing' end end describe 'UIImage' do it 'should convert image data (PNG) to base64' do 'test'.uiimage.nsdata.to_base64.should == 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAHgCAIAAADrGJBNAAAAAXNSR0IArs4c6QAAABxpRE9UAAAAAgAAAAAAAADwAAAAKAAAAPAAAADwAAAAS9r5uVEAAAAXSURBVEgNYrhrxMAwikfDYDQNDMk0AAAAAP//6TQa9AAAABVJREFUY7hrxMAwikfDYDQNDMk0AACNnfwwqs717AAAAABJRU5ErkJggg==' end end end
Version data entries
10 entries across 10 versions & 1 rubygems