Code Monkey home page Code Monkey logo

Comments (8)

noniq avatar noniq commented on August 15, 2024

Confirmed. For app/lib/foobar.rb, what should the correct alternate file be – spec/app/lib/foobar_spec.rb or spec/lib/foobar_spec.rb?

from rspec.tmbundle.

glennfu avatar glennfu commented on August 15, 2024

I just tried this today and app/lib/foobar.rb correctly created the alternate file spec/lib/foobar_spec.rb. Seems good to me!

It definitely shouldn't contain /app/ otherwise we'd expect app/models/foobar.rb to map to no longer map to spec/models/foobar_spec.rb.

from rspec.tmbundle.

noniq avatar noniq commented on August 15, 2024

Did you try it inside a Rails app?

In Rails apps, lib/foobar.rb is already mapped to spec/foobar_spec.rb, so not sure if we should map app/lib/foobar.rb also to spec/foobar_spec.rb

from rspec.tmbundle.

noniq avatar noniq commented on August 15, 2024

It just occured to me that app/lib/foobar.rb should map to spec/models/lib/foobar.rb. Would make sense, wouldn’t it?

from rspec.tmbundle.

glennfu avatar glennfu commented on August 15, 2024

Oh I see what you mean now. While I suppose that might be a matter of preference, I can't think of a better option. I also can't imagine a situation in which both app/lib/foobar.rb and app/models/lib/foobar.rb both exist at the same time, so I think your solution makes sense.

from rspec.tmbundle.

noniq avatar noniq commented on August 15, 2024

Ah, app/lib/foobar.rb vs. app/models/lib/foobar.rb was the case I didn’t think of – but as you say, I think we can ignore that :-)

from rspec.tmbundle.

glennfu avatar glennfu commented on August 15, 2024

Other projects like RubyMine simply search all folders for a filename matching the pattern which is super lazy, and doesn't try to create anything. We're already going above and beyond in helpfulness here. If someone has super strange structure they can complain to us, or just navigate back and forth themselves :)

from rspec.tmbundle.

noniq avatar noniq commented on August 15, 2024

You know that feeling when you look at something you wrote some hours ago and it just doesn’t make sense anymore? app/lib/foobar.rb ↔︎ spec/models/lib doesn’t make sense. I think I’ll go with app/lib/foobar.rb ↔︎ spec/app/lib/foobar.rb – this is at least guaranteed not to collide with anything else.

from rspec.tmbundle.

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.