2016-07-27 11:17:50 -05:00
|
|
|
require 'test_helper'
|
|
|
|
|
|
|
|
class QuizStatusTest < ActiveSupport::TestCase
|
|
|
|
test "roy has started test" do
|
|
|
|
roy = candidates :roy
|
|
|
|
status = QuizStatus.new roy
|
|
|
|
|
|
|
|
assert status.started
|
|
|
|
end
|
|
|
|
|
|
|
|
test "martha has NOT started test" do
|
|
|
|
martha = candidates :martha
|
|
|
|
status = QuizStatus.new martha
|
|
|
|
|
|
|
|
refute status.started
|
|
|
|
end
|
|
|
|
|
|
|
|
test "dawn is on summary page" do
|
|
|
|
dawn = candidates :dawn
|
|
|
|
status = QuizStatus.new dawn
|
|
|
|
|
|
|
|
assert status.on_summary
|
|
|
|
end
|
|
|
|
|
|
|
|
test "roy is NOT on summary" do
|
|
|
|
roy = candidates :roy
|
|
|
|
status = QuizStatus.new roy
|
|
|
|
|
|
|
|
refute status.on_summary
|
|
|
|
end
|
|
|
|
|
|
|
|
test "roy has NOT submitted" do
|
|
|
|
roy = candidates :roy
|
|
|
|
status = QuizStatus.new roy
|
|
|
|
|
|
|
|
refute status.completed
|
|
|
|
end
|
|
|
|
|
|
|
|
test "richard is complete" do
|
|
|
|
richard = candidates :richard
|
|
|
|
status = QuizStatus.new richard
|
|
|
|
|
|
|
|
assert status.completed
|
|
|
|
end
|
|
|
|
|
|
|
|
test "dawn can NOT submit" do
|
|
|
|
dawn = candidates :dawn
|
|
|
|
status = QuizStatus.new dawn
|
|
|
|
|
|
|
|
refute status.can_submit
|
|
|
|
end
|
|
|
|
|
|
|
|
test "richard can submit" do
|
|
|
|
richard = candidates :richard
|
|
|
|
status = QuizStatus.new richard
|
|
|
|
|
|
|
|
assert status.can_submit
|
|
|
|
end
|
2016-07-27 22:53:14 -05:00
|
|
|
|
|
|
|
test "richard is at 100%" do
|
|
|
|
richard = candidates :richard
|
|
|
|
status = QuizStatus.new richard
|
|
|
|
|
|
|
|
assert_equal 100, status.progress
|
|
|
|
end
|
|
|
|
|
|
|
|
test "roy is 20% done" do
|
|
|
|
roy = candidates :roy
|
|
|
|
status = QuizStatus.new roy
|
|
|
|
|
|
|
|
assert_equal 20, status.progress
|
|
|
|
end
|
|
|
|
|
|
|
|
test "martha is 0% done" do
|
|
|
|
martha = candidates :martha
|
|
|
|
status = QuizStatus.new martha
|
|
|
|
|
|
|
|
assert_equal 0, status.progress
|
|
|
|
end
|
2016-07-29 13:34:23 -05:00
|
|
|
|
|
|
|
test "roy is on question 3" do
|
|
|
|
roy = candidates :roy
|
|
|
|
status = QuizStatus.new roy
|
|
|
|
|
|
|
|
assert_equal questions(:fed3).id, status.current_question_id
|
|
|
|
end
|
|
|
|
|
|
|
|
test "martha is on question 1" do
|
|
|
|
martha = candidates :martha
|
|
|
|
status = QuizStatus.new martha
|
|
|
|
|
|
|
|
assert_equal questions(:fed1).id, status.current_question_id
|
|
|
|
end
|
|
|
|
|
2016-08-09 23:17:35 -05:00
|
|
|
test "dawn is on summary" do
|
|
|
|
dawn = candidates :dawn
|
|
|
|
status = QuizStatus.new dawn
|
2016-07-29 13:34:23 -05:00
|
|
|
|
|
|
|
assert_equal nil, status.current_question_id
|
|
|
|
end
|
2016-07-27 11:17:50 -05:00
|
|
|
end
|