Code Monkey home page Code Monkey logo

Comments (3)

parroty avatar parroty commented on July 24, 2024

Thanks for the comment. As you indicated, it's downcased and hasn't provided the way to maintain the original case.

https://github.com/parroty/exvcr/blob/v0.8.1/lib/exvcr/mock.ex#L116

If it doesn't break existing tests, it may be an option to provide some way (like providing a optional setting) to maintain the case.

from exvcr.

gmile avatar gmile commented on July 24, 2024

@parroty the motivation behind this is that it's easy to run into problems with case sensitive / case insensitive file systems. I, for one, just did and lost a few hours yesterday debugging the issue with travis build.

Per travis docs:

The HFS+ file system on our OS X workers is case-insensitive (which is the default for OS X), and the files in a directory are returned sorted. On Linux, the file system is case-sensitive, and returns directory entries in the order they appear in the directory internally.

I ran exactly into this problem.

I got used to naming my cassette folders after test modules, e.g. Stripe.PlanTest/, MyLib.MyModuleTest/, etc. Now, given the FS differences and the fact that ExVCR downcases paths on the fly, I experienced the following:

  1. OS X: MyLib.MyModuleTest/my_cassette.json == mylib.mymoduletest/my_cassette.json, thus the cassettes are found and everything works,
  2. Linux: MyLib.MyModuleTest/my_cassette.json != mylib.mymoduletest/my_cassette.json, ExVCR doesn't find the cassette folder, and performs actual requests.

I think the best way to solve this would be to not downcase at all. However, making this optional is a good way resolve this in a short term (with default to perform downcase, e.g. no behaviour change). Yet in the long term I think a few additional things should happen:

  1. remove downcasing logic entirely in future release (after all, since the cassette names in tests are written manually by a human, most will expect that ExVCR resolves the exact file path specified in the use_cassette),
  2. in case of perform_downcase: true (or whatever this option would be called), add a warning that this flag will be removed in future release and the behaviour will change to always match the path.

Let me know if this makes sense.

from exvcr.

parroty avatar parroty commented on July 24, 2024

Thanks for the explanation and sorry being late to respond.
The explanation makes sense. In the short term, I prefer the option like perform_downcase: true though it maybe good to change at some point. I try to update the code, but pull request would great too :-)

from exvcr.

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.