Skip to content

Instantly share code, notes, and snippets.

@salex
Last active December 17, 2015 17:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save salex/5643322 to your computer and use it in GitHub Desktop.
Save salex/5643322 to your computer and use it in GitHub Desktop.
Refactored Score, as class and tests
## app/models/assessable/scoring.rb
module Assessable
module Scoring
class Score
class Score
attr :post, :total_raw, :total_weighted, :scores
def initialize(assessment,post)
#@assessment = assessment
@post = post
add_all_array_to_post
@total_raw = @total_weighted = 0
@scores = {"max" => {"raw" => assessment["max_raw"].round(3), "weighted" => assessment["max_weighted"].round(3)}}
score_questions(assessment)
end
def get_post
post = self.post
post["scores"] = self.scores
return post
end
def add_all_array_to_post
all = []
@post["answer"].each do |key,value|
all.concat(value)
end
@post["all"] = all
end
def score_questions(assessment)
assessment["questions"].each do |question|
score_question(question)
end
@scores["total"] = {'raw' => @total_raw, 'weighted' => @total_weighted}
@scores["percent"] = {'raw' => to_percent(@total_raw, @scores["max"]["raw"]) , 'weighted' => to_percent(@total_weighted, @scores["max"]["weighted"])}
return self
end
def score_question(question)
qkey = question["id"].to_s
answered = @post["answer"][qkey]
# return if question is not answered in post (question not required and not answered)
return if answered.nil? || answered.empty?
@score_method = question["score_method"].downcase
case @score_method
when 'none'
# return if question is answered in post but not scored
return
when 'textcontains'
score_text_contains(question,answered)
when 'textnumeric'
score_text_numeric(question,answered)
else
score_value(question,answered)
end
end
def get_answer_keys(question)
a_keys = question["answers"].collect{|i| i["id"].to_s}
end
def to_percent(total,max)
return 0.0 if max.zero?
percent = (total / max).round(3)
end
def score_text_contains(question,answered)
a_keys = get_answer_keys(question)
txt_idx = 0
sum = 0
question["answers"].each do |answer|
answer = question["answers"][a_keys.index(answered[txt_idx])]
texteval = Assessable::TextEval::Contains.new(answer["text_eval"])
value = texteval.score(@post["text"][answered[txt_idx]],answer["value"])
sum += value
txt_idx += 1
end
set_score(question,sum)
end
def score_text_numeric(question,answered)
a_keys = get_answer_keys(question)
txt_idx = 0
sum = 0
question["answers"].each do |answer|
answer = question["answers"][a_keys.index(answered[txt_idx])]
texteval = Assessable::TextEval::Numeric.new(answer["text_eval"])
value = texteval.score(@post["text"][answered[txt_idx]],answer["value"])
sum += value
txt_idx += 1
end
set_score(question,sum)
end
def score_value(question,answered)
sum = 0
max = -1 # allow for a 0 value
question["answers"].each do |answer|
akey = answer["id"].to_s
unless answered.index(akey).nil?
sum += answer["value"] ||= 0
max = answer["value"] if answer["value"] > max
end
end
value = @score_method == 'sum' ? sum : max
set_score(question,value)
end
def set_score(question,value)
qkey = question["id"].to_s
@total_raw += value
@total_weighted += (value * question["weight"])
@scores[qkey] = {'raw' => value, 'weighted' => (value * question["weight"])}
# if critical add qid to a critical array
if question["critical"]
if value < question["min_critical"]
@scores['critical'] = [] unless @scores['critical']
@scores['critical'] << qkey
end
end
end
end
end
end
## scoring_test.rb
require 'test_helper'
describe Assessable::Scoring do
require 'test_helper'
describe Assessable::Scoring do
before do
@assessment = {"id"=>1, "max_raw"=>4.0, "max_weighted"=>4.0,
"questions"=>[{"critical"=>true, "id"=>1, "min_critical"=>1.0, "score_method"=>"Value", "weight"=>1.0,
"answers"=>[{"id"=>1, "text_eval"=>nil, "value"=>0.0}, {"id"=>2, "text_eval"=>nil, "value"=>1.0}, {"id"=>3, "text_eval"=>nil, "value"=>2.0}]},
{"critical"=>false, "id"=>2, "min_critical"=>nil, "score_method"=>"Value", "weight"=>1.0,
"answers"=>[{"id"=>11, "text_eval"=>nil, "value"=>0.0}, {"id"=>12, "text_eval"=>nil, "value"=>1.0}, {"id"=>13, "text_eval"=>nil, "value"=>2.0}]}]}
@post = {"answer"=>{"1"=>["1"], "2"=>["13"]}}
@score = nil
end
describe "score creates new object" do
it "must be a score object" do
@score = Assessable::Scoring::Score.new(@assessment,@post)
@score.must_be_instance_of Assessable::Scoring::Score
@score.total_raw.must_equal 2
@score.scores["max"]["raw"].must_equal @assessment["max_raw"]
end
end
describe "can modify the before assessment" do
it "max must be different after modify" do
@assessment["max_raw"] = 10.0
@score = Assessable::Scoring::Score.new(@assessment,@post)
@score.scores["max"]["raw"].must_equal 10.0
@score.must_be_instance_of Assessable::Scoring::Score
end
end
describe "critical failure" do
it "should have a critical failure" do
@score = Assessable::Scoring::Score.new(@assessment,@post)
@score.scores["critical"].wont_be_nil
end
it "should say question 1 failed critical test" do
@score = Assessable::Scoring::Score.new(@assessment,@post)
@score.scores["critical"][0].must_equal "1"
end
it "should not fail critical" do
@assessment = {"id"=>1, "max_raw"=>4.0, "max_weighted"=>4.0,
"questions"=>[{"critical"=>false, "id"=>1, "min_critical"=>1.0, "score_method"=>"Value", "weight"=>1.0,
"answers"=>[{"id"=>1, "text_eval"=>nil, "value"=>0.0}, {"id"=>2, "text_eval"=>nil, "value"=>1.0}, {"id"=>3, "text_eval"=>nil, "value"=>2.0}]}]}
@post = {"answer"=>{"1"=>["1"]}}
@score = Assessable::Scoring::Score.new(@assessment,@post)
@score.scores["critical"].must_be_nil
end
end
describe "Sum scoring" do
it "should sum to 3 if all checked" do
@assessment = {"id"=>1, "max_raw"=>3.0, "max_weighted"=>3.0,
"questions"=>[{"critical"=>true, "id"=>1, "min_critical"=>1.0, "score_method"=>"Sum", "weight"=>1.0,
"answers"=>[{"id"=>1, "text_eval"=>nil, "value"=>0.0}, {"id"=>2, "text_eval"=>nil, "value"=>1.0}, {"id"=>3, "text_eval"=>nil, "value"=>2.0}]}]}
@post = {"answer"=>{"1"=>["1","2","3"]}}
@score = Assessable::Scoring::Score.new(@assessment,@post)
@score.total_raw.must_equal 3.0
@score.scores["percent"]["raw"].must_equal 1.0
end
it "should sum to 3 if 2 & 3 checked" do
@assessment = {"id"=>1, "max_raw"=>3.0, "max_weighted"=>3.0,
"questions"=>[{"critical"=>true, "id"=>1, "min_critical"=>1.0, "score_method"=>"Sum", "weight"=>1.0,
"answers"=>[{"id"=>1, "text_eval"=>nil, "value"=>0.0}, {"id"=>2, "text_eval"=>nil, "value"=>1.0}, {"id"=>3, "text_eval"=>nil, "value"=>2.0}]}]}
@post = {"answer"=>{"1"=>["2","3"]}}
@score = Assessable::Scoring::Score.new(@assessment,@post)
@score.total_raw.must_equal 3.0
end
it "should sum to 0 if 1 checked" do
@assessment = {"id"=>1, "max_raw"=>3.0, "max_weighted"=>3.0,
"questions"=>[{"critical"=>true, "id"=>1, "min_critical"=>1.0, "score_method"=>"Sum", "weight"=>1.0,
"answers"=>[{"id"=>1, "text_eval"=>nil, "value"=>0.0}, {"id"=>2, "text_eval"=>nil, "value"=>1.0}, {"id"=>3, "text_eval"=>nil, "value"=>2.0}]}]}
@post = {"answer"=>{"1"=>["1"]}}
@score = Assessable::Scoring::Score.new(@assessment,@post)
@score.total_raw.must_equal 0.0
end
it "should sum to 1 if 2 checked" do
@assessment = {"id"=>1, "max_raw"=>3.0, "max_weighted"=>3.0,
"questions"=>[{"critical"=>true, "id"=>1, "min_critical"=>1.0, "score_method"=>"Sum", "weight"=>1.0,
"answers"=>[{"id"=>1, "text_eval"=>nil, "value"=>0.0}, {"id"=>2, "text_eval"=>nil, "value"=>1.0}, {"id"=>3, "text_eval"=>nil, "value"=>2.0}]}]}
@post = {"answer"=>{"1"=>["2"]}}
@score = Assessable::Scoring::Score.new(@assessment,@post)
@score.total_raw.must_equal 1.0
@score.scores["percent"]["raw"].must_equal 0.333
end
it "should sum to 2 if 3 checked" do
@assessment = {"id"=>1, "max_raw"=>3.0, "max_weighted"=>3.0,
"questions"=>[{"critical"=>true, "id"=>1, "min_critical"=>1.0, "score_method"=>"Sum", "weight"=>1.0,
"answers"=>[{"id"=>1, "text_eval"=>nil, "value"=>0.0}, {"id"=>2, "text_eval"=>nil, "value"=>1.0}, {"id"=>3, "text_eval"=>nil, "value"=>2.0}]}]}
@post = {"answer"=>{"1"=>["3"]}}
@score = Assessable::Scoring::Score.new(@assessment,@post)
@score.total_raw.must_equal 2.0
end
end
describe "max scoring" do
it "should sum to 2 if all checked" do
@assessment = {"id"=>1, "max_raw"=>2.0, "max_weighted"=>3.0,
"questions"=>[{"critical"=>true, "id"=>1, "min_critical"=>1.0, "score_method"=>"max", "weight"=>1.0,
"answers"=>[{"id"=>1, "text_eval"=>nil, "value"=>0.0}, {"id"=>2, "text_eval"=>nil, "value"=>1.0}, {"id"=>3, "text_eval"=>nil, "value"=>2.0}]}]}
@post = {"answer"=>{"1"=>["1","2","3"]}}
@score = Assessable::Scoring::Score.new(@assessment,@post)
@score.total_raw.must_equal 2.0
end
it "should sum to 0 if 1 checked" do
@assessment = {"id"=>1, "max_raw"=>2.0, "max_weighted"=>3.0,
"questions"=>[{"critical"=>true, "id"=>1, "min_critical"=>1.0, "score_method"=>"max", "weight"=>1.0,
"answers"=>[{"id"=>1, "text_eval"=>nil, "value"=>0.0}, {"id"=>2, "text_eval"=>nil, "value"=>1.0}, {"id"=>3, "text_eval"=>nil, "value"=>2.0}]}]}
@post = {"answer"=>{"1"=>["1"]}}
@score = Assessable::Scoring::Score.new(@assessment,@post)
@score.total_raw.must_equal 0.0
end
it "should sum to 1 if 2 checked" do
@assessment = {"id"=>1, "max_raw"=>2.0, "max_weighted"=>3.0,
"questions"=>[{"critical"=>true, "id"=>1, "min_critical"=>1.0, "score_method"=>"max", "weight"=>1.0,
"answers"=>[{"id"=>1, "text_eval"=>nil, "value"=>0.0}, {"id"=>2, "text_eval"=>nil, "value"=>1.0}, {"id"=>3, "text_eval"=>nil, "value"=>2.0}]}]}
@post = {"answer"=>{"1"=>["2"]}}
@score = Assessable::Scoring::Score.new(@assessment,@post)
@score.total_raw.must_equal 1.0
end
it "should sum to 2 if 3 checked" do
@assessment = {"id"=>1, "max_raw"=>2.0, "max_weighted"=>3.0,
"questions"=>[{"critical"=>true, "id"=>1, "min_critical"=>1.0, "score_method"=>"max", "weight"=>1.0,
"answers"=>[{"id"=>1, "text_eval"=>nil, "value"=>0.0}, {"id"=>2, "text_eval"=>nil, "value"=>1.0}, {"id"=>3, "text_eval"=>nil, "value"=>2.0}]}]}
@post = {"answer"=>{"1"=>["3"]}}
@score = Assessable::Scoring::Score.new(@assessment,@post)
@score.total_raw.must_equal 2.0
end
end
describe "value scoring" do
it "should sum to 0 if 1 checked" do
@assessment = {"id"=>1, "max_raw"=>2.0, "max_weighted"=>3.0,
"questions"=>[{"critical"=>true, "id"=>1, "min_critical"=>1.0, "score_method"=>"value", "weight"=>1.0,
"answers"=>[{"id"=>1, "text_eval"=>nil, "value"=>0.0}, {"id"=>2, "text_eval"=>nil, "value"=>1.0}, {"id"=>3, "text_eval"=>nil, "value"=>2.0}]}]}
@post = {"answer"=>{"1"=>["1"]}}
@score = Assessable::Scoring::Score.new(@assessment,@post)
@score.total_raw.must_equal 0.0
end
it "should sum to 1 if 2 checked" do
@assessment = {"id"=>1, "max_raw"=>2.0, "max_weighted"=>3.0,
"questions"=>[{"critical"=>true, "id"=>1, "min_critical"=>1.0, "score_method"=>"value", "weight"=>1.0,
"answers"=>[{"id"=>1, "text_eval"=>nil, "value"=>0.0}, {"id"=>2, "text_eval"=>nil, "value"=>1.0}, {"id"=>3, "text_eval"=>nil, "value"=>2.0}]}]}
@post = {"answer"=>{"1"=>["2"]}}
@score = Assessable::Scoring::Score.new(@assessment,@post)
@score.total_raw.must_equal 1.0
@score.scores["percent"]["raw"].must_be_close_to 0.50009
assert_in_delta 0.5, @score.scores["percent"]["raw"], 0.001, "close enough"
end
it "should sum to 2 if 3 checked" do
@assessment = {"id"=>1, "max_raw"=>2.0, "max_weighted"=>3.0,
"questions"=>[{"critical"=>true, "id"=>1, "min_critical"=>1.0, "score_method"=>"value", "weight"=>1.0,
"answers"=>[{"id"=>1, "text_eval"=>nil, "value"=>0.0}, {"id"=>2, "text_eval"=>nil, "value"=>1.0}, {"id"=>3, "text_eval"=>nil, "value"=>2.0}]}]}
@post = {"answer"=>{"1"=>["3"]}}
@score = Assessable::Scoring::Score.new(@assessment,@post)
@score.total_raw.must_equal 2.0
end
end
describe "none scoring" do
it "should sum to 0 if anything checked" do
@assessment = {"id"=>1, "max_raw"=>2.0, "max_weighted"=>3.0,
"questions"=>[{"critical"=>true, "id"=>1, "min_critical"=>1.0, "score_method"=>"none", "weight"=>1.0,
"answers"=>[{"id"=>1, "text_eval"=>nil, "value"=>0.0}, {"id"=>2, "text_eval"=>nil, "value"=>1.0}, {"id"=>3, "text_eval"=>nil, "value"=>2.0}]}]}
@post = {"answer"=>{"1"=>["1","2","3"]}}
@score = Assessable::Scoring::Score.new(@assessment,@post)
@score.total_raw.must_equal 0.0
end
end
describe "Weighted value score" do
it "should sum to 6 if anything checked" do
@assessment = {"id"=>1, "max_raw"=>2.0, "max_weighted"=>6.0,
"questions"=>[{"critical"=>true, "id"=>1, "min_critical"=>1.0, "score_method"=>"value", "weight"=>3.0,
"answers"=>[{"id"=>1, "text_eval"=>nil, "value"=>0.0}, {"id"=>2, "text_eval"=>nil, "value"=>1.0}, {"id"=>3, "text_eval"=>nil, "value"=>2.0}]}]}
@post = {"answer"=>{"1"=>["3"]}}
@score = Assessable::Scoring::Score.new(@assessment,@post)
@score.total_raw.must_equal 2.0
@score.total_weighted.must_equal 6.0
end
end
describe "text contains scoring" do
it "should match one" do
@assessment = {"id"=>1, "max_raw"=>2.0, "max_weighted"=>6.0,
"questions"=>[{"critical"=>true, "id"=>1, "min_critical"=>1.0, "score_method"=>"textcontains", "weight"=>3.0,
"answers"=>[{"id"=>1, "text_eval"=>"one", "value"=>1.0}]}]}
@post = {"answer"=>{"1"=>["1"]}, "text"=> {"1" =>"one"}}
@score = Assessable::Scoring::Score.new(@assessment,@post)
@score.total_raw.must_equal 1.0
end
it "should not match two" do
@assessment = {"id"=>1, "max_raw"=>2.0, "max_weighted"=>6.0,
"questions"=>[{"critical"=>true, "id"=>1, "min_critical"=>1.0, "score_method"=>"textcontains", "weight"=>3.0,
"answers"=>[{"id"=>1, "text_eval"=>"one", "value"=>1.0}]}]}
@post = {"answer"=>{"1"=>["1"]}, "text"=> {"1" =>"two"}}
@score = Assessable::Scoring::Score.new(@assessment,@post)
@score.total_raw.must_equal 0.0
end
it "should not or two" do
@assessment = {"id"=>1, "max_raw"=>2.0, "max_weighted"=>6.0,
"questions"=>[{"critical"=>true, "id"=>1, "min_critical"=>1.0, "score_method"=>"textcontains", "weight"=>3.0,
"answers"=>[{"id"=>1, "text_eval"=>"(one|two)", "value"=>1.0}]}]}
@post = {"answer"=>{"1"=>["1"]}, "text"=> {"1" =>"two"}}
@score = Assessable::Scoring::Score.new(@assessment,@post)
@score.total_raw.must_equal 1.0
end
it "should not match one&two" do
@assessment = {"id"=>1, "max_raw"=>2.0, "max_weighted"=>6.0,
"questions"=>[{"critical"=>true, "id"=>1, "min_critical"=>1.0, "score_method"=>"textcontains", "weight"=>3.0,
"answers"=>[{"id"=>1, "text_eval"=>"one&two", "value"=>1.0}]}]}
@post = {"answer"=>{"1"=>["1"]}, "text"=> {"1" =>"two"}}
@score = Assessable::Scoring::Score.new(@assessment,@post)
@score.total_raw.must_equal 0.0
end
it "should match one&two" do
@assessment = {"id"=>1, "max_raw"=>2.0, "max_weighted"=>6.0,
"questions"=>[{"critical"=>true, "id"=>1, "min_critical"=>1.0, "score_method"=>"textcontains", "weight"=>3.0,
"answers"=>[{"id"=>1, "text_eval"=>"one&two", "value"=>1.0}]}]}
@post = {"answer"=>{"1"=>["1"]}, "text"=> {"1" =>"two one"}}
@score = Assessable::Scoring::Score.new(@assessment,@post)
@score.total_raw.must_equal 1.0
end
it "should match partial two" do
@assessment = {"id"=>1, "max_raw"=>2.0, "max_weighted"=>6.0,
"questions"=>[{"critical"=>true, "id"=>1, "min_critical"=>1.0, "score_method"=>"textcontains", "weight"=>3.0,
"answers"=>[{"id"=>1, "text_eval"=>"one&two::two%%50.0", "value"=>1.0}]}]}
@post = {"answer"=>{"1"=>["1"]}, "text"=> {"1" =>"two "}}
@score = Assessable::Scoring::Score.new(@assessment,@post)
@score.total_raw.must_equal 0.5
end
it "should match one&two but not three" do
@assessment = {"id"=>1, "max_raw"=>2.0, "max_weighted"=>6.0,
"questions"=>[{"critical"=>true, "id"=>1, "min_critical"=>1.0, "score_method"=>"textcontains", "weight"=>3.0,
"answers"=>[{"id"=>1, "text_eval"=>"one&two&!three", "value"=>1.0}]}]}
@post = {"answer"=>{"1"=>["1"]}, "text"=> {"1" =>"two one three"}}
@score = Assessable::Scoring::Score.new(@assessment,@post)
@score.total_raw.must_equal 0.0
end
it "should match one&two but 50% partial three" do
@assessment = {"id"=>1, "max_raw"=>2.0, "max_weighted"=>6.0,
"questions"=>[{"critical"=>true, "id"=>1, "min_critical"=>1.0, "score_method"=>"textcontains", "weight"=>3.0,
"answers"=>[{"id"=>1, "text_eval"=>"one&two&!three::one&two&three%%50.0", "value"=>1.0}]}]}
@post = {"answer"=>{"1"=>["1"]}, "text"=> {"1" =>"two one three"}}
@score = Assessable::Scoring::Score.new(@assessment,@post)
@score.total_raw.must_equal 0.5
end
end
describe "text numeric scoring" do
it "should match 3.1416" do
@assessment = {"id"=>1, "max_raw"=>1.0, "max_weighted"=>3.0,
"questions"=>[{"critical"=>true, "id"=>1, "min_critical"=>1.0, "score_method"=>"textnumeric", "weight"=>3.0,
"answers"=>[{"id"=>1, "text_eval"=>"3.1416", "value"=>1.0}]}]}
@post = {"answer"=>{"1"=>["1"]}, "text"=> {"1" =>"3.1416"}}
@score = Assessable::Scoring::Score.new(@assessment,@post)
@score.total_raw.must_equal 1.0
end
it "should not match 3.14159" do
@assessment = {"id"=>1, "max_raw"=>1.0, "max_weighted"=>3.0,
"questions"=>[{"critical"=>true, "id"=>1, "min_critical"=>1.0, "score_method"=>"textnumeric", "weight"=>3.0,
"answers"=>[{"id"=>1, "text_eval"=>"3.1416", "value"=>1.0}]}]}
@post = {"answer"=>{"1"=>["1"]}, "text"=> {"1" =>"3.14159"}}
@score = Assessable::Scoring::Score.new(@assessment,@post)
@score.total_raw.must_equal 0.0
end
it "should match 3.14159 with delta" do
@assessment = {"id"=>1, "max_raw"=>1.0, "max_weighted"=>3.0,
"questions"=>[{"critical"=>true, "id"=>1, "min_critical"=>1.0, "score_method"=>"textnumeric", "weight"=>3.0,
"answers"=>[{"id"=>1, "text_eval"=>"3.1416::0.00001%%100.0", "value"=>1.0}]}]}
@post = {"answer"=>{"1"=>["1"]}, "text"=> {"1" =>"3.14159"}}
@score = Assessable::Scoring::Score.new(@assessment,@post)
@score.total_raw.must_equal 1.0
end
it "should match 3.14159 with delta 50% partial" do
@assessment = {"id"=>1, "max_raw"=>1.0, "max_weighted"=>3.0,
"questions"=>[{"critical"=>true, "id"=>1, "min_critical"=>1.0, "score_method"=>"textnumeric", "weight"=>3.0,
"answers"=>[{"id"=>1, "text_eval"=>"3.1416::0.00001%%50.0", "value"=>1.0}]}]}
@post = {"answer"=>{"1"=>["1"]}, "text"=> {"1" =>"3.14159"}}
@score = Assessable::Scoring::Score.new(@assessment,@post)
@score.total_raw.must_equal 0.5
end
end
end
# results
==============================================================================
SUITE test/dummy/config/environments,test/dummy/test,test,test/dummy/app/controllers,test/dummy/app/helpers,test/dummy/app/helpers/assessable,test/dummy/app/models,test/dummy/config,test/dummy/config/initializers,test/dummy/db/migrate,test/dummy/db,test/dummy/test/models,test/helpers/assessable,test/integration,test/models (SEED 63441)
==============================================================================
Assessable::Scoring::Sum scoring
0005 should sum to 2 if 3 checked 0:00:00.007 PASS
0001 should sum to 3 if all checked 0:00:00.007 PASS
0004 should sum to 1 if 2 checked 0:00:00.007 PASS
0002 should sum to 3 if 2 & 3 checked 0:00:00.007 PASS
0003 should sum to 0 if 1 checked 0:00:00.007 PASS
Assessable::Scoring::Weighted value score
0001 should sum to 6 if anything checked 0:00:00.008 PASS
Assessable::Scoring::can modify the before assessment
0001 max must be different after modify 0:00:00.009 PASS
Assessable::Scoring::critical failure
0001 should have a critical failure 0:00:00.009 PASS
0002 should say question 1 failed critical test 0:00:00.010 PASS
0003 should not fail critical 0:00:00.010 PASS
Assessable::Scoring::max scoring
0004 should sum to 2 if 3 checked 0:00:00.010 PASS
0002 should sum to 0 if 1 checked 0:00:00.011 PASS
0001 should sum to 2 if all checked 0:00:00.011 PASS
0003 should sum to 1 if 2 checked 0:00:00.011 PASS
Assessable::Scoring::none scoring
0001 should sum to 0 if anything checked 0:00:00.012 PASS
Assessable::Scoring::score creates new object
0001 must be a score object 0:00:00.012 PASS
Assessable::Scoring::text contains scoring
0004 should not match one&two 0:00:00.013 PASS
0001 should match one 0:00:00.013 PASS
0008 should match one&two but 50% partial three 0:00:00.013 PASS
0003 should not or two 0:00:00.014 PASS
0006 should match partial two 0:00:00.014 PASS
0002 should not match two 0:00:00.014 PASS
0005 should match one&two 0:00:00.015 PASS
0007 should match one&two but not three 0:00:00.015 PASS
Assessable::Scoring::text numeric scoring
0004 should match 3.14159 with delta 50% partial 0:00:00.016 PASS
0002 should not match 3.14159 0:00:00.016 PASS
0001 should match 3.1416 0:00:00.016 PASS
0003 should match 3.14159 with delta 0:00:00.016 PASS
Assessable::Scoring::value scoring
0003 should sum to 2 if 3 checked 0:00:00.017 PASS
0002 should sum to 1 if 2 checked 0:00:00.017 PASS
0001 should sum to 0 if 1 checked 0:00:00.017 PASS
==============================================================================
pass: 31, fail: 0, error: 0, skip: 0
total: 31 tests with 39 assertions in 0.018127 seconds
===============================================================
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment