-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Default to creating all the types of folders? #693
Comments
I think this is probably a good idea. Do you have time to work up a pull request? |
@alindeman I do tonight, so I'll see what I can put together. |
@envygeeks I'm a bit confused as to what you expect SimpleCov's output to be when you have no controllers yet and how rspec default folders add to that - could you please expand your example? |
@colszowka I had a ton of controllers but oddly it didn't start covering them until I created the controllers folder in my spec folder... I don't know who's fault it could have been (I assumed badly of course) that it was simplecovs fault but I was unable to replicate it so it might have been something else causing the problem the only thing I do know is the problem was resolved with the folder just being there. |
Were you able to work something up? :) |
OMG this is definitely the thing to do! I have been in a lot of doubt and confusion about which directories I should create under spec and what goes where. At first I thought there is no difference and everything just gets loaded and run; now I know that isn't the case and directories do have meanings. But then there's the support subdirectory where everything does just get loaded an run in no particular order. Oh my! RSpec does have to have a task that generates a skeleton for all the specs!!1 |
Whether or not we add an option to GENERATE ALL THE FOLDERS ™, the behavior you're describing sounds like an issue w/ SimpleCov. I haven't used it yet myself (no offense, @colszowka - but I stopped using rcov long before SimpleCov came around) so I don't know the ins/outs, but it seems odd that SimpleCov would suddenly work when a directory under spec appears. |
Essentially there is no reason why SimpleCov should require this folder to be in place. The gem itself is entirely framework-agnostic and only should mind the code that has been loaded and executed after simplecov's been fired up. There is some additional goodness for rails, test/unit, rspec and cucumber in automatically naming test suites for the reports, but that's about as framework-specific as it gets. What I can imagine is that the actual controllers were not being loaded by Rails before you added actual spec files that referenced their constants. With the default Maybe rspec-rails also has some automatic loading for matching spec/* vs. app/* dirs, that I do not know, but it could be another explanation why they didn't show up before. If you have simplecov setup correctly, all the files that your source code |
Such a long trip to dodge something. |
@dchelimsky @colszowka I don't actually know who's fault it was that this wasn't happening, actually I had badly assumed that it was SimpleCov's fault, but brought it here because if the fix was to just add a folder... so it was a 2 birds one stone type of scenario. Though it could have been the fault of the software I use to run my tests (since I don't use RSpec autotest) I just haven't had time to look into it. I'm not blaming anybody really, so I hope nobody ever took this as a bug complaint, just a sort of feature request in the form of well this happened maybe we could do this since this fixed it, plus it doesn't hurt to do it! |
Actually it does, IMO. It's extra stuff to maintain in rspec, and not everybody uses every type of folder, so for many people this would just be extra noise. |
I don't see how a few folders inside of the template folder adds a lot of maint. I also only added the /basic/ folders. |
Maintenance is not only in the code. What's basic to you is not basic to everybody, which means we'll have a feature that works for some folks and not for others, which means that others will ask us to make the feature configurable, since it's a feature we've committed to supporting, etc, etc. If we don't add the feature to begin with, none of that happens. Also consider that these directories get created when you use the rails generator to generate a skeleton spec, so the problem of knowing where to put what is already solved. So that leaves us choosing to solve a weird integration bug between rspec and simplecov that we don't understand yet by adding an otherwise low value hack to rspec. I don't think it's a great value proposition. |
Problem solved, happy day. |
It would be nice if you could provide the option to (or just do) create each folder for all the types of specs, the reason I ask this is because SimpleCov seems to not cover pieces unless their folders exist. For example it skipped over controller coverage completely until I created controllers, so it would be nice if all the folders existed by default so that coverage is properly handled or if a warning was put in the Readme about it.
/cc @colszowka
The text was updated successfully, but these errors were encountered: