The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
MockFS 0.1.2

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Francis Hwang

Posts: 130
Nickname: francis
Registered: Jul, 2004

Francis Hwang is the Director of Technology at Rhizome.org.
MockFS 0.1.2 Posted: Sep 21, 2005 10:53 AM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by Francis Hwang.
Original Post: MockFS 0.1.2
Feed Title: Francis Hwang's site: ruby
Feed URL: http://fhwang.net/syndicate/ruby.atom
Feed Description: Author & artist Francis Hwang's personal site.
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Francis Hwang
Latest Posts From Francis Hwang's site: ruby

Advertisement

MockFS lumbers forward with its newest release, 0.1.2. Besides a liberal heaping of bugfixes, this version adds override.rb, which does some convenient but possibly dangerous redefining of global constants and methods. Ooh, danger!

What’s MockFS?

MockFS is nothing less than an attempt to simulate a file system in memory for the purposes of testing. I wrote it for my own use, because I write lots of tests and sometimes I get sick of cleaning up test files. It’s a lot simpler to just simulate the disk in memory and drop the whole thing when you’re done with your test.

It’s not complete by a longshot, but it’s complete enough that I’m able to use it to help me write tests for production code—most notably, for Rhizome.org, a community website that gets more than a million pageviews a month.

What’s new in 0.1.2?

  • First, a lot of little things have been fixed. MockFS now has a better understanding of file permissions, of paths, and the multiple ways that File, FileUtils, and Dir allow the same method to be called through class or instance methods.
  • I’ve also added override.rb, which redefines File, FileUtils, and Dir. This is so your code doesn’t have to reference MockFS directly; the test cases can include override.rb and reference the mock file system that way.

override.rb also includes a redefinition of Kernel.require, so that if a file doesn’t exist in the real file system, Kernel.require will look for it in the mock file system. This might be useful in cases where you have configuration files written in Ruby, and would like to swap them out during testing.

Pretty much everything in override.rb is experimental, so I’d urge caution in including the file.

Read: MockFS 0.1.2

Topic: A little RubyForge "trove" bug fix Previous Topic   Next Topic Topic: Ruby 1.8.3 Preview Two

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use