Created
March 8, 2012 17:22
-
-
Save ksexton/2002188 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# play_spec.rb | |
require 'tempfile' | |
require './play' | |
describe 'uuencode' do | |
before do | |
file = Tempfile.new('play_spec') | |
file.print "Lorum Ipsum" | |
file.rewind | |
@coded = uuencode(file) | |
file.unlink | |
file = Tempfile.new('play_spec') | |
file.puts "Lorum Ipsum" | |
file.puts "Lorum Ipsum" | |
file.puts "Lorum Ipsum" | |
file.puts "Lorum Ipsum" | |
file.puts "Lorum Ipsum" | |
file.rewind | |
@multiline_coded = uuencode(file) | |
file.each_line do |i| | |
puts i | |
end | |
file.unlink | |
end | |
it "should return a string" do | |
@coded.class.should == String | |
end | |
it "should uuencode" do | |
@coded.should == "TG9ydW0gSXBzdW0=\n" | |
end | |
it "should handle multiline input" do | |
@multiline_coded.should == "TG9ydW0gSXBzdW0K\nTG9ydW0gSXBzdW0K\nTG9ydW0gSXBzdW0K\nTG9ydW0gSXBzdW0K\nTG9ydW0gSXBzdW0K\n" | |
end | |
end | |
describe 'uudecode' do | |
before do | |
file = Tempfile.new('play_spec') | |
file.write "TG9ydW0gSXBzdW0=\n" | |
file.rewind | |
@coded = uudecode(file) | |
file = Tempfile.new('play_spec') | |
file.write "TG9ydW0gSXBzdW0K\nTG9ydW0gSXBzdW0K\nTG9ydW0gSXBzdW0K\nTG9ydW0gSXBzdW0K\nTG9ydW0gSXBzdW0K\n" | |
file.rewind | |
@multiline_coded = uudecode(file) | |
end | |
it "should return a string" do | |
@coded.class.should == String | |
end | |
it "should uudecode" do | |
@coded.should == "Lorum Ipsum" | |
end | |
it "should handle multiline files" do | |
@multiline_coded.should == "Lorum Ipsum\nLorum Ipsum\nLorum Ipsum\nLorum Ipsum\nLorum Ipsum\n" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment