Open frnco opened 2 years ago
I would welcome tests :) that said I don't think it's needed at this point. I usually test with RSpec
.
In my opinion, the ideal would be testing that the routes load without errors, and testing that all URL's that take any parameters actually return results matching those parameters, which could even skip the routes/controllers and just test passing the expected parameters to the methods in the models that actually fetch the appropriate data.
Sounds great :+1:
While checking the code for the website I couldn't find any tests, and upon checking the Gemfile didn't find any of the test frameworks I'm used to.
While I do agree that it's easy to over-test front-end-code in Rails without gaining much from it, I think it'd be wise to have some tests for the models, especially considering I'm working on a route to search sandboxes, which I believe deserves, at the very least, some tests to make sure it's taking the appropriate
params
and returning results that match thoseparams
. At the very least I'd include tests for the models, assuming the controller only passes theparams
to appropriate methods in the models. I don't think it's imperative that we test the whole front-end-stuff, though maybe it's worth testing the JSON returned by the Sandbox API, but I believe it's worth having some tests for the stuff that actually communicates with the database.On the other hand, I avoid introducing dependencies as much as possible, so I'm trying to figure out the most simple and clean way to test the features I'm working on. But then again, there's a chance the maintainers already have plans to introduce some testing framework, in which case it'd be better to make my code fit their plain, thus I opened this issue.
I'm not fond of testing front-end in Rails, it usually ends up with tests that break for the wrong reasons, but I'm also skeptical of having more complex models untested, I'm trying to figure out how those things should be balanced in this case. In my opinion, the ideal would be testing that the routes load without errors, and testing that all URL's that take any parameters actually return results matching those parameters, which could even skip the routes/controllers and just test passing the expected parameters to the methods in the models that actually fetch the appropriate data.
What's the maintainers' opinions on this?