Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

executable file 38 lines (27 sloc) 1.163 kb
#!/usr/bin/env ruby
# -*- mode: ruby -*-
# An example use of the Ruby autograder
require './lib/auto_grader.rb'
require 'ruby-debug'
def grade(file,spec)
end
def usage
STDERR.puts <<EndOfHelp
Usage: #{$0} submission.rb specfile.rb
Creates an autograder of the RspecGrader subclass (which evaluates student
code based solely on RSpec output) and grades the submission.rb file with it.
For example, try these, where PREFIX=rag/spec/fixtures:
#{$0} $PREFIX/correct_example.rb $PREFIX/correct_example.spec.rb
#{$0} $PREFIX/example_with_syntax_error.rb $PREFIX/correct_example.spec.rb
#{$0} $PREFIX/example_with_runtime_exception.rb $PREFIX/correct_example.spec.rb
EndOfHelp
exit
end
usage() if (ARGV.length!=2 || ARGV[0] =~ /^-?-h/)
g = AutoGrader.create('1', 'WeightedRspecGrader', IO.read(ARGV[0]), :spec => ARGV[1])
g.grade!
puts "Score out of 100: #{g.normalized_score(100)}\n"
puts "---BEGIN rspec comments---\n#{'-'*80}\n#{g.comments}\n#{'-'*80}\n---END rspec comments---"
# PFX = 'spec/fixtures'
# grade "#{PFX}/correct_example.rb", "#{PFX}/correct_example.spec.rb"
# grade "#{PFX}/example_with_syntax_error.rb", "#{PFX}/correct_example.spec.rb"
Jump to Line
Something went wrong with that request. Please try again.