Sha256: ab120f1cbea69e66fbb9aa3d02042e50b9491cb298f47713cb8e981b0f905390

Contents?: true

Size: 1.22 KB

Versions: 1

Compression:

Stored size: 1.22 KB

Contents

#
# When recording calls to instance methods of File and Dir, a reference to
# the instance is passed to the method call being recorded. During the "record"
# phase, the target of the call is an instance of "real" File (or Dir).
#
# During VirtFS activation, The File constant is mapped to VirtFS::vFile,
# and a reference to the "real" File class is saved in the VfsRealFile constant.
#
# When instanitating an instance of the File class, we need to ensure we always
# use the "real" File class (as opposed to VirtFS::vFile). However, if we use
# the VfsRealFile constant to do this, it results in recording an ambiguous
# instance reference to the cassette. This is because:
#
#    VfsRealFile.class.name == File          (not VfsRealFile)
#    File.class.name        == File          (when not activated)
#    File.class.name        == VirtFS::vFile (when activated)
#
# This results in failed cassette playback during activation because it won't
# be able to find a VirtFS::vFile entry in the cassette.
#
# Using a proper subclass of the "real" File class solves this problem, because:
#    CcRealFile.class.name == CcRealFile
#
module VirtFS::CamcorderFS # rubocop:disable Style/ClassAndModuleChildren
  class RealDir < VfsRealDir
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
virtfs-camcorderfs-0.0.1 lib/virtfs/camcorderfs/real_dir.rb