big start on QuizStatus
This commit is contained in:
		@@ -3,8 +3,7 @@ MAINTAINER Mark Moser <markamoser@gmail.com>
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
WORKDIR ~/
 | 
					WORKDIR ~/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ENV MYSQL_ALLOW_EMPTY_PASSWORD=yes
 | 
					ENV MYSQL_ROOT_PASSWORD=root
 | 
				
			||||||
ENV MYSQL_ROOT_PASSWORD=
 | 
					 | 
				
			||||||
ENV BUILD_PACKAGES="build-essential libmysqlclient-dev openssl graphviz nodejs curl wget zlib1g-dev tmux"
 | 
					ENV BUILD_PACKAGES="build-essential libmysqlclient-dev openssl graphviz nodejs curl wget zlib1g-dev tmux"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
RUN apt-get update \
 | 
					RUN apt-get update \
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -15,7 +15,7 @@
 | 
				
			|||||||
#
 | 
					#
 | 
				
			||||||
# and, you'll have to watch "config/Guardfile" instead of "Guardfile"
 | 
					# and, you'll have to watch "config/Guardfile" instead of "Guardfile"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
guard :minitest do
 | 
					guard :minitest, spring: true, all_after_pass: true do
 | 
				
			||||||
  watch(%r{^test/test_helper\.rb$}) { 'test' }
 | 
					  watch(%r{^test/test_helper\.rb$}) { 'test' }
 | 
				
			||||||
  watch(%r{^test/(.*)\/?(.*)_test\.rb$})
 | 
					  watch(%r{^test/(.*)\/?(.*)_test\.rb$})
 | 
				
			||||||
  watch(%r{^app/(.*/)?([^/]+)\.rb$}) { |m| "test/#{m[1]}#{m[2]}_test.rb" }
 | 
					  watch(%r{^app/(.*/)?([^/]+)\.rb$}) { |m| "test/#{m[1]}#{m[2]}_test.rb" }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,4 +1,6 @@
 | 
				
			|||||||
class Candidate < ApplicationRecord
 | 
					class Candidate < ApplicationRecord
 | 
				
			||||||
 | 
					  belongs_to :quiz
 | 
				
			||||||
 | 
					  has_many :questions, through: :quiz
 | 
				
			||||||
  has_many :answers
 | 
					  has_many :answers
 | 
				
			||||||
  belongs_to :recruiter, class_name: "User"
 | 
					  belongs_to :recruiter, class_name: "User"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -8,6 +10,14 @@ class Candidate < ApplicationRecord
 | 
				
			|||||||
  validates_presence_of :test_hash
 | 
					  validates_presence_of :test_hash
 | 
				
			||||||
  validates_uniqueness_of :test_hash
 | 
					  validates_uniqueness_of :test_hash
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  def submitted_answers
 | 
				
			||||||
 | 
					    answers.where(submitted: true)
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  def answered_questions
 | 
				
			||||||
 | 
					    answers.where.not(answer: nil)
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  private
 | 
					  private
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def generate_test_hash
 | 
					    def generate_test_hash
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,3 +1,4 @@
 | 
				
			|||||||
class Quiz < ApplicationRecord
 | 
					class Quiz < ApplicationRecord
 | 
				
			||||||
  has_many :questions
 | 
					  has_many :questions
 | 
				
			||||||
 | 
					  has_many :candidates
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										23
									
								
								app/workers/quiz_status.rb
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								app/workers/quiz_status.rb
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,23 @@
 | 
				
			|||||||
 | 
					class QuizStatus
 | 
				
			||||||
 | 
					  attr_reader :candidate
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  def initialize candidate
 | 
				
			||||||
 | 
					    @candidate = Candidate.find(candidate.to_i)
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  def started
 | 
				
			||||||
 | 
					    candidate.answers.count > 0
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  def on_summary
 | 
				
			||||||
 | 
					    candidate.submitted_answers.count == candidate.questions.count
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  def completed
 | 
				
			||||||
 | 
					    candidate.completed
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  def can_submit
 | 
				
			||||||
 | 
					    on_summary && candidate.answered_questions.count == candidate.questions.count
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
@@ -14,7 +14,7 @@ default: &default
 | 
				
			|||||||
  encoding: utf8
 | 
					  encoding: utf8
 | 
				
			||||||
  pool: 5
 | 
					  pool: 5
 | 
				
			||||||
  username: root
 | 
					  username: root
 | 
				
			||||||
  password:
 | 
					  password: root
 | 
				
			||||||
  host: localhost
 | 
					  host: localhost
 | 
				
			||||||
 | 
					
 | 
				
			||||||
development:
 | 
					development:
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										6
									
								
								db/migrate/20160727154057_add_quiz_to_candidate.rb
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								db/migrate/20160727154057_add_quiz_to_candidate.rb
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,6 @@
 | 
				
			|||||||
 | 
					class AddQuizToCandidate < ActiveRecord::Migration[5.0]
 | 
				
			||||||
 | 
					  def change
 | 
				
			||||||
 | 
					    add_column :candidates, :quiz_id, :integer
 | 
				
			||||||
 | 
					    add_index :candidates, :quiz_id
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
@@ -10,7 +10,7 @@
 | 
				
			|||||||
#
 | 
					#
 | 
				
			||||||
# It's strongly recommended that you check this file into your version control system.
 | 
					# It's strongly recommended that you check this file into your version control system.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ActiveRecord::Schema.define(version: 20160726193255) do
 | 
					ActiveRecord::Schema.define(version: 20160727154057) do
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  create_table "answers", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
 | 
					  create_table "answers", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
 | 
				
			||||||
    t.integer  "candidate_id"
 | 
					    t.integer  "candidate_id"
 | 
				
			||||||
@@ -35,6 +35,8 @@ ActiveRecord::Schema.define(version: 20160726193255) do
 | 
				
			|||||||
    t.boolean  "reminded"
 | 
					    t.boolean  "reminded"
 | 
				
			||||||
    t.datetime "created_at",   null: false
 | 
					    t.datetime "created_at",   null: false
 | 
				
			||||||
    t.datetime "updated_at",   null: false
 | 
					    t.datetime "updated_at",   null: false
 | 
				
			||||||
 | 
					    t.integer  "quiz_id"
 | 
				
			||||||
 | 
					    t.index ["quiz_id"], name: "index_candidates_on_quiz_id", using: :btree
 | 
				
			||||||
    t.index ["recruiter_id"], name: "index_candidates_on_recruiter_id", using: :btree
 | 
					    t.index ["recruiter_id"], name: "index_candidates_on_recruiter_id", using: :btree
 | 
				
			||||||
    t.index ["test_hash"], name: "index_candidates_on_test_hash", unique: true, using: :btree
 | 
					    t.index ["test_hash"], name: "index_candidates_on_test_hash", unique: true, using: :btree
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										6
									
								
								rebuild-dev-db.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										6
									
								
								rebuild-dev-db.sh
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,6 @@
 | 
				
			|||||||
 | 
					#!/bin/bash
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					rails db:drop && \
 | 
				
			||||||
 | 
					rails db:setup && \
 | 
				
			||||||
 | 
					rails db:migrate && \
 | 
				
			||||||
 | 
					rails db:fixtures:load
 | 
				
			||||||
@@ -1,3 +1,4 @@
 | 
				
			|||||||
 | 
					#!/bin/bash
 | 
				
			||||||
if [ -d '/usr/app' ]; then
 | 
					if [ -d '/usr/app' ]; then
 | 
				
			||||||
  cd /usr/app
 | 
					  cd /usr/app
 | 
				
			||||||
  bundle
 | 
					  bundle
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,3 +1,4 @@
 | 
				
			|||||||
 | 
					#!/bin/bash
 | 
				
			||||||
if [ -d '/usr/app' ]; then
 | 
					if [ -d '/usr/app' ]; then
 | 
				
			||||||
  cd /usr/app
 | 
					  cd /usr/app
 | 
				
			||||||
  bundle
 | 
					  bundle
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										65
									
								
								test/fixtures/answers.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										65
									
								
								test/fixtures/answers.yml
									
									
									
									
										vendored
									
									
								
							@@ -24,8 +24,8 @@ dawn1:
 | 
				
			|||||||
  answer: option-1
 | 
					  answer: option-1
 | 
				
			||||||
  saved: 0
 | 
					  saved: 0
 | 
				
			||||||
  submitted: true
 | 
					  submitted: true
 | 
				
			||||||
  created_at: <%= DateTime.now() - 2280.minutes %>
 | 
					  created_at: <%= DateTime.now() - 38.hours - 50.minutes %>
 | 
				
			||||||
  updated_at: <%= DateTime.now() - 2280.minutes %>
 | 
					  updated_at: <%= DateTime.now() - 38.hours - 50.minutes %>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
dawn2:
 | 
					dawn2:
 | 
				
			||||||
  candidate: dawn
 | 
					  candidate: dawn
 | 
				
			||||||
@@ -33,8 +33,8 @@ dawn2:
 | 
				
			|||||||
  answer: ["option2", "option-4"]
 | 
					  answer: ["option2", "option-4"]
 | 
				
			||||||
  saved: 0
 | 
					  saved: 0
 | 
				
			||||||
  submitted: true
 | 
					  submitted: true
 | 
				
			||||||
  created_at: <%= DateTime.now() - 2282.minutes %>
 | 
					  created_at: <%= DateTime.now() - 38.hours - 50.minutes %>
 | 
				
			||||||
  updated_at: <%= DateTime.now() - 2282.minutes %>
 | 
					  updated_at: <%= DateTime.now() - 38.hours - 50.minutes %>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
dawn3:
 | 
					dawn3:
 | 
				
			||||||
  candidate: dawn
 | 
					  candidate: dawn
 | 
				
			||||||
@@ -42,8 +42,8 @@ dawn3:
 | 
				
			|||||||
  answer: {html: "<h1>I'm a little tealpot</h1>", css: 'h1: {color: teal;}', js: ''}
 | 
					  answer: {html: "<h1>I'm a little tealpot</h1>", css: 'h1: {color: teal;}', js: ''}
 | 
				
			||||||
  saved: 0
 | 
					  saved: 0
 | 
				
			||||||
  submitted: true
 | 
					  submitted: true
 | 
				
			||||||
  created_at: <%= DateTime.now() - 2284.minutes %>
 | 
					  created_at: <%= DateTime.now() - 38.hours - 50.minutes %>
 | 
				
			||||||
  updated_at: <%= DateTime.now() - 2284.minutes %>
 | 
					  updated_at: <%= DateTime.now() - 38.hours - 50.minutes %>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
dawn4:
 | 
					dawn4:
 | 
				
			||||||
  candidate: dawn
 | 
					  candidate: dawn
 | 
				
			||||||
@@ -51,8 +51,8 @@ dawn4:
 | 
				
			|||||||
  answer: Vestibulum id ligula porta felis euismod semper. Sed posuere consectetur est at lobortis.
 | 
					  answer: Vestibulum id ligula porta felis euismod semper. Sed posuere consectetur est at lobortis.
 | 
				
			||||||
  saved: 0
 | 
					  saved: 0
 | 
				
			||||||
  submitted: true
 | 
					  submitted: true
 | 
				
			||||||
  created_at: <%= DateTime.now() - 2288.minutes %>
 | 
					  created_at: <%= DateTime.now() - 38.hours - 50.minutes %>
 | 
				
			||||||
  updated_at: <%= DateTime.now() - 2288.minutes %>
 | 
					  updated_at: <%= DateTime.now() - 38.hours - 50.minutes %>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
dawn5:
 | 
					dawn5:
 | 
				
			||||||
  candidate: dawn
 | 
					  candidate: dawn
 | 
				
			||||||
@@ -60,8 +60,53 @@ dawn5:
 | 
				
			|||||||
  answer: "option 3"
 | 
					  answer: "option 3"
 | 
				
			||||||
  saved: 0
 | 
					  saved: 0
 | 
				
			||||||
  submitted: true
 | 
					  submitted: true
 | 
				
			||||||
  created_at: <%= DateTime.now() - 2292.minutes %>
 | 
					  created_at: <%= DateTime.now() - 38.hours - 50.minutes %>
 | 
				
			||||||
  updated_at: <%= DateTime.now() - 2292.minutes %>
 | 
					  updated_at: <%= DateTime.now() - 38.hours - 50.minutes %>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					dawn6:
 | 
				
			||||||
 | 
					  candidate: dawn
 | 
				
			||||||
 | 
					  question: fed6
 | 
				
			||||||
 | 
					  answer: Integer posuere erat a ante venenatis dapibus posuere velit aliquet.
 | 
				
			||||||
 | 
					  saved: 0
 | 
				
			||||||
 | 
					  submitted: true
 | 
				
			||||||
 | 
					  created_at: <%= DateTime.now() - 38.hours - 32.minutes %>
 | 
				
			||||||
 | 
					  updated_at: <%= DateTime.now() - 38.hours - 12.minutes %>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					dawn7:
 | 
				
			||||||
 | 
					  candidate: dawn
 | 
				
			||||||
 | 
					  question: fed7
 | 
				
			||||||
 | 
					  answer: {html: '<p>This means <strong>jQuery</strong> needs to be available in live-coder!</p>', css: 'strong: {font-size: 1.6em;} green: {color: green;}', js: '$("strong").addClass("green");'}
 | 
				
			||||||
 | 
					  saved: 0
 | 
				
			||||||
 | 
					  submitted: true
 | 
				
			||||||
 | 
					  created_at: <%= DateTime.now() - 38.hours - 34.minutes %>
 | 
				
			||||||
 | 
					  updated_at: <%= DateTime.now() - 38.hours - 14.minutes %>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					dawn8:
 | 
				
			||||||
 | 
					  candidate: dawn
 | 
				
			||||||
 | 
					  question: fed8
 | 
				
			||||||
 | 
					  answer: option2
 | 
				
			||||||
 | 
					  saved: 0
 | 
				
			||||||
 | 
					  submitted: true
 | 
				
			||||||
 | 
					  created_at: <%= DateTime.now() - 38.hours - 38.minutes %>
 | 
				
			||||||
 | 
					  updated_at: <%= DateTime.now() - 38.hours - 16.minutes %>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					dawn9:
 | 
				
			||||||
 | 
					  candidate: dawn
 | 
				
			||||||
 | 
					  question: fed9
 | 
				
			||||||
 | 
					  answer: Grunt
 | 
				
			||||||
 | 
					  saved: 0
 | 
				
			||||||
 | 
					  submitted: true
 | 
				
			||||||
 | 
					  created_at: <%= DateTime.now() - 38.hours - 38.minutes %>
 | 
				
			||||||
 | 
					  updated_at: <%= DateTime.now() - 38.hours - 18.minutes %>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					dawn10:
 | 
				
			||||||
 | 
					  candidate: dawn
 | 
				
			||||||
 | 
					  question: fed10
 | 
				
			||||||
 | 
					  answer:
 | 
				
			||||||
 | 
					  saved: 1
 | 
				
			||||||
 | 
					  submitted: true
 | 
				
			||||||
 | 
					  created_at: <%= DateTime.now() - 38.hours - 40.minutes %>
 | 
				
			||||||
 | 
					  updated_at: <%= DateTime.now() - 38.hours - 20.minutes %>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
richard1:
 | 
					richard1:
 | 
				
			||||||
  candidate: richard
 | 
					  candidate: richard
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										4
									
								
								test/fixtures/candidates.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								test/fixtures/candidates.yml
									
									
									
									
										vendored
									
									
								
							@@ -5,6 +5,7 @@ roy:
 | 
				
			|||||||
  email: roy.cruz@mailinator.com
 | 
					  email: roy.cruz@mailinator.com
 | 
				
			||||||
  experience: 0-3
 | 
					  experience: 0-3
 | 
				
			||||||
  recruiter: reviewer
 | 
					  recruiter: reviewer
 | 
				
			||||||
 | 
					  quiz: fed
 | 
				
			||||||
  completed: false
 | 
					  completed: false
 | 
				
			||||||
  reminded: false
 | 
					  reminded: false
 | 
				
			||||||
  test_hash: NmEjDkOEKY4
 | 
					  test_hash: NmEjDkOEKY4
 | 
				
			||||||
@@ -14,6 +15,7 @@ martha:
 | 
				
			|||||||
  email: martha.watts@mailinator.com
 | 
					  email: martha.watts@mailinator.com
 | 
				
			||||||
  experience: 4-6
 | 
					  experience: 4-6
 | 
				
			||||||
  recruiter: reviewer
 | 
					  recruiter: reviewer
 | 
				
			||||||
 | 
					  quiz: fed
 | 
				
			||||||
  completed: false
 | 
					  completed: false
 | 
				
			||||||
  reminded: false
 | 
					  reminded: false
 | 
				
			||||||
  test_hash: R67PmfDHGiw
 | 
					  test_hash: R67PmfDHGiw
 | 
				
			||||||
@@ -23,6 +25,7 @@ dawn:
 | 
				
			|||||||
  email: dawn.hopkins@mailinator.com
 | 
					  email: dawn.hopkins@mailinator.com
 | 
				
			||||||
  experience: 0-2
 | 
					  experience: 0-2
 | 
				
			||||||
  recruiter: reviewer
 | 
					  recruiter: reviewer
 | 
				
			||||||
 | 
					  quiz: fed
 | 
				
			||||||
  completed: false
 | 
					  completed: false
 | 
				
			||||||
  reminded: true
 | 
					  reminded: true
 | 
				
			||||||
  test_hash: OvP0ZqGKwJ0
 | 
					  test_hash: OvP0ZqGKwJ0
 | 
				
			||||||
@@ -32,6 +35,7 @@ richard:
 | 
				
			|||||||
  email: richard.burns@mailinator.com
 | 
					  email: richard.burns@mailinator.com
 | 
				
			||||||
  experience: 15+
 | 
					  experience: 15+
 | 
				
			||||||
  recruiter: reviewer
 | 
					  recruiter: reviewer
 | 
				
			||||||
 | 
					  quiz: fed
 | 
				
			||||||
  completed: true
 | 
					  completed: true
 | 
				
			||||||
  reminded: false
 | 
					  reminded: false
 | 
				
			||||||
  test_hash: 6NjnourLE6Y
 | 
					  test_hash: 6NjnourLE6Y
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,5 @@
 | 
				
			|||||||
ENV['RAILS_ENV'] ||= 'test'
 | 
					ENV['RAILS_ENV'] ||= 'test'
 | 
				
			||||||
# require 'single_cov'
 | 
					
 | 
				
			||||||
# SingleCov.setup :minitest
 | 
					 | 
				
			||||||
require File.expand_path('../../config/environment', __FILE__)
 | 
					require File.expand_path('../../config/environment', __FILE__)
 | 
				
			||||||
require 'rails/test_help'
 | 
					require 'rails/test_help'
 | 
				
			||||||
require "minitest/autorun"
 | 
					require "minitest/autorun"
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										59
									
								
								test/workers/quiz_status_test.rb
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										59
									
								
								test/workers/quiz_status_test.rb
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,59 @@
 | 
				
			|||||||
 | 
					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
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
		Reference in New Issue
	
	Block a user