firstdraft / appdev_template

A Rails template for generating homework projects
0 stars 1 forks source link

Update JSON rspec formatter to not show NAN% when project is worth no points #113

Closed jelaniwoods closed 4 years ago

jelaniwoods commented 4 years ago

Resolves firstdraft/grades#404

After countless piazza questions about NaN% :

Since rails grade is just running

rspec --order default --format JsonOutputFormatter

If you run that rspec command in a project with no points (like base-rails) it produces something like:

{"version":"3.9.0","examples":[
{"description":"has no tests","full_description":"This project has no tests",
"hint":null,"status":"passed",
"points":null,"file_path":"./spec/features/dummy_spec.rb",
"line_number":4,"run_time":0.00346}],
"summary":
{"duration":0.007012,"example_count":1,"failure_count":0,
"pending_count":0,"total_points":0,"earned_points":0,"score":null},
"summary_line":"1 tests, 0 failures, 0/0 points, NaN%"}%

This change updates

{"version":"3.9.0","examples":[
{"description":"has no tests","full_description":"This project has no tests",
"hint":null,"status":"passed",
"points":null,"file_path":"./spec/features/dummy_spec.rb",
"line_number":4,"run_time":0.001988}],
"summary":
{"duration":0.003999,"example_count":1,"failure_count":0,
"pending_count":0,"total_points":0,"earned_points":0,"score":null},
"summary_line":"1 tests, 0 failures, 0/0 points, This project is not graded."}%
Screen Shot 2020-03-05 at 8 01 17 PM
pmckernin commented 4 years ago

This looks great, and I think it will prevent several future piazza questions. Good thinking and good work!! :shipit:

raghubetina commented 4 years ago

Good idea. LGTM :ship: