Željko Filipin's Blog on Software and Testing

Test like you do not need the money.

Archive for the ‘Ruby’ Category

TMail 1.1.0 Gem Released

without comments

stamp-sm.jpg

I have been using TMail for testing e-mail functionality of web application that I test for a long time. But, development of that library stopped at 2004. Today I found out that it is again in development. Take a look at it’s web site and RubyForge project site.

Written by Željko Filipin

October 31st, 2007 at 9:00 am

Posted in E-mail,Ruby

Everyday Scripting with Ruby Arrived

without comments

pa300022.JPG

Long long time ago, I was reviewer of Brian Marick’s Everyday Scripting with Ruby. On February 2, 2007 Pragmatic Programmers said they would send me a free copy, but it did not arrive for a long time. I exchanged a few e-mails with them, and today the book arrived. I did not even have time to unwrap it yet. :)

Written by Željko Filipin

October 30th, 2007 at 11:27 am

Posted in Books,Ruby

warning: toplevel constant File referenced by IO::File

with one comment

I want to delete a file from Application::Mail.download. The problem is that inside Application module, File.delete calls Application::File.delete.

module Application
class File
def delete
end
end
class Mail
def self.download
File.delete “mail.eml”
end
end
end

Application::Mail.download

Run this code and you will get error message:

Exception: undefined method `delete' for Application::File:Class

I could rename Application::File to something else, but I created Application module because I wanted to name my classes as I wish without conflicts with Ruby classes.

One solution is to specify that I want to call IO::File.delete.

def self.download
IO::File.delete “mail.eml”
end

But then I get this warning:

warning: toplevel constant File referenced by IO::File

How to ignore warning thread at ruby-forum.com provided the solution to removing warning. Add this at the beginning of the file:

$VERBOSE = nil

But, I want to see other warnings. I know I can change the value of $VERBOSE to nil just before I call IO::File.delete and then change it back. That just feels wrong. Why am I getting that warning after all? Why do I get the warning after calling IO::File.delete? Am I doing something wrong?

Written by Željko Filipin

October 25th, 2007 at 3:27 pm

Posted in Ruby