GithubHelp home page GithubHelp logo

Comments (4)

jmhodges avatar jmhodges commented on July 20, 2024

This is a larger issue that fakefs does not also mock out the non-module constants that File and FileUtils has. We'll have to be ever so slightly tricky because some of the constants are OS and possibly machine dependent.

File.constants.each do |c| 
  unless File.const_get(c).is_a?(Module)
    puts "#{c}: #{File.const_get(c).inspect}"
  end
end

Output on Mac OS X 10.5:

    NOCTTY: 131072
    Separator: "/"
    LOCK_EX: 2
    CREAT: 512
    RDONLY: 0
    FNM_DOTMATCH: 4
    PATH_SEPARATOR: ":"
    TRUNC: 1024
    SEEK_END: 2
    LOCK_SH: 1
    APPEND: 8
    FNM_PATHNAME: 2
    ALT_SEPARATOR: nil
    LOCK_NB: 4
    NONBLOCK: 4
    SEEK_CUR: 1
    RDWR: 2
    FNM_SYSCASE: 0
    SYNC: 128
    FNM_NOESCAPE: 1
    SEPARATOR: "/"
    LOCK_UN: 8
    EXCL: 2048
    SEEK_SET: 0
    WRONLY: 1
    FNM_CASEFOLD: 8

from fakefs.

jmhodges avatar jmhodges commented on July 20, 2024

I have pushed up a quick 10 minute implementation (with tests) to jmhodges/fakefs/with_constants. It's a little wet, and I can imagine some people having an issue with it, but it does the job.

A cleaned up version would probably be nice, but this seems acceptable.

from fakefs.

jmhodges avatar jmhodges commented on July 20, 2024

This is me trying to say I'd like a code review before I push it to defunkt's master.

from fakefs.

jmhodges avatar jmhodges commented on July 20, 2024

Okay, so this was actually already fixed. My branch explicitly tested for File.const_defined?(WHATEVER) which was failing even though there was a self.const_missing already there.

So, fixed in 5b5961f.

from fakefs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.