ResultsController is now tested
Updated 8 months, 1 week ago
| Gabriel Roy-Lortie | Reviewers | ||
| markus_developers | |||
| 400, 448 | |||
| None | MarkUs Source Code Repository | ||
Relates to tickets #400 and #448 I'm not implying that it's a thorough test suite, but It's a lot better than it was (empty). It also allowed me to figure out, and remove a couple of bugs. Regarding #448: The three methods were effectively dead code. They've been removed. The new fixture files will ship with my first review to get a "ship it". This one, or the FlexibleCriteriaController one.
This review request is all about writing tests. Unit tests are still top shape. I have to say, for the record, that, by modifying *many* fixture files I introduced a failure in one of the "functional" test. Before: 29 failures, 28 errors After: 30 failures, 24 errors Unfortunately, I can't figure out where it is. Which one, of the 30 failures, is the new one? I'm sorry that I can't tell. What I can tell, in revenge, is that: 1) all recently developed tests are still working; and 2) there's no test that features only one failure -- Implying that no test suite went from clean to broken... those that worked, still does, and those that were broken still are. It's surely not perfect. But I believe that letting this code through to the repository has more advantages than inconvenients. Let me state once again that I don't like fixtures. I am still looking in a replacement. I had some issues with factory_girl and am on to look for machinist. I'll keep you posted.
Posted 8 months, 2 weeks ago (November 12th, 2009, 1:05 a.m.)
Some comments on my modifications.
-
trunk/app/controllers/results_controller.rb (Diff revision 1) -
Was dead code.
-
trunk/app/controllers/results_controller.rb (Diff revision 1) -
Using an array leads to a crash on line (old:50, new:29) when used with a big criterion.id The array didn't made sense anyway.
-
trunk/app/controllers/results_controller.rb (Diff revision 1) -
Same Array problem here.
-
trunk/app/controllers/results_controller.rb (Diff revision 1) -
Was dead code.
-
trunk/app/controllers/results_controller.rb (Diff revision 1) -
Was dead code.
-
trunk/app/views/results/common/_annotations.js.erb (Diff revision 1) -
Rails was complaining about that space.
-
trunk/app/views/results/common/_annotations.js.erb (Diff revision 1) -
Same here.
Review request changed
Updated 8 months, 2 weeks ago (November 13th, 2009, 4:52 p.m.)
-
- added Diff r2
Added partial files: views/shared/_handle_error.rjs and views/results/marker/_update_mark.rjs
Removed all occurences of:
partial :update {|page| page...}
replacing them with the partials I created.
Posted 8 months, 2 weeks ago (November 16th, 2009, 1:28 p.m.)
Any reason why nobody reviewed yet?
Posted 8 months, 2 weeks ago (November 16th, 2009, 2:03 p.m.)
Looks great! I just had one question about the ResultsControllerTest concerning a TA using the download method. See below.
-
trunk/app/controllers/results_controller.rb (Diff revision 2) -
Ah, much better. Thinner controllers is good!
-
trunk/test/functional/results_controller_test.rb (Diff revision 2) -
Well, you could always take the response_body, and use some regex to see if the error string you're looking for is in there. It's a bit hacky, but it's an idea.
-
trunk/test/functional/results_controller_test.rb (Diff revision 2) -
Really? I'm pretty sure both TA's and Admin's can download files from the ResultsController.
Review request changed
Updated 8 months, 2 weeks ago (November 16th, 2009, 5:03 p.m.)
-
- added Diff r3
Applied Mike's comments: Using a regex to assert that the response contains the appropriate error messages (when rendering a partial). Allowed for TAs to send GET download requests.
Posted 8 months, 2 weeks ago (November 16th, 2009, 5:22 p.m.)
-
trunk/test/functional/results_controller_test.rb (Diff revision 3) -
I think it would be a good idea to put this "sample error msg" in a variable and use it throughout the test (i.e. in the assert_match).
Review request changed
Updated 8 months, 1 week ago (November 20th, 2009, midnight)
-
- added Diff r4
Replaced all those 'sample error msg' string with a constant.
