mockfs 0.1.5 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. data/lib/mockfs.rb +9 -2
  2. data/lib/mockfs.rb~ +4 -2
  3. metadata +2 -2
@@ -94,7 +94,7 @@ require 'fileutils'
94
94
  require 'singleton'
95
95
 
96
96
  module MockFS
97
- Version = '0.1.5'
97
+ Version = '0.1.6'
98
98
 
99
99
  @@mock = false
100
100
 
@@ -142,7 +142,7 @@ module MockFS
142
142
  end
143
143
 
144
144
  module Adapter #:nodoc:
145
- @@delegated_methods = [ :delete, :entries, :mtime ]
145
+ @@delegated_methods = [ :delete, :entries, :mtime, :size ]
146
146
 
147
147
  def method_missing( sym, *args )
148
148
  if @@delegated_methods.include?( sym )
@@ -165,6 +165,10 @@ module MockFS
165
165
 
166
166
  def self.[]( string ); glob( string, 0 ); end
167
167
 
168
+ def self.foreach( dirname, &block )
169
+ entries( dirname ).each( &block )
170
+ end
171
+
168
172
  def self.glob( string, flags = 0 )
169
173
  DirAdapter.new( '.' ).send( :glob, string, flags ).map { |result|
170
174
  Path.new( result )[1..-1]
@@ -356,6 +360,8 @@ module MockFS
356
360
  file.parent = dest_dir
357
361
  end
358
362
 
363
+ def self.mkpath( path ); MockFS.fill_path( path ); end
364
+
359
365
  class << self
360
366
  def mv( src, dest, options = {} )
361
367
  cp( src, dest, options )
@@ -485,6 +491,7 @@ module MockFS
485
491
  def clone
486
492
  rewind
487
493
  clone = self.class.new( @parent, @name, gets( nil ) )
494
+ rewind
488
495
  clone.mtime = @mtime
489
496
  clone
490
497
  end
@@ -94,7 +94,7 @@ require 'fileutils'
94
94
  require 'singleton'
95
95
 
96
96
  module MockFS
97
- Version = '0.1.4'
97
+ Version = '0.1.5'
98
98
 
99
99
  @@mock = false
100
100
 
@@ -312,7 +312,9 @@ module MockFS
312
312
  def self.read( name )
313
313
  mfile = node name
314
314
  raise Errno::EISDIR if mfile.is_a? MockFileSystem::MockDir
315
- mfile.read
315
+ contents = mfile.read
316
+ mfile.rewind
317
+ contents
316
318
  end
317
319
 
318
320
  class Mode #:nodoc:
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.11
3
3
  specification_version: 1
4
4
  name: mockfs
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.1.5
7
- date: 2006-12-31 00:00:00 -05:00
6
+ version: 0.1.6
7
+ date: 2007-01-21 00:00:00 -05:00
8
8
  summary: MockFS is a test-obsessed library for mocking out the entire file system.
9
9
  require_paths:
10
10
  - lib