added simplecov for test coverge report
This commit is contained in:
@ -1,5 +1,12 @@
|
||||
ENV['RAILS_ENV'] ||= 'test'
|
||||
|
||||
# https://github.com/colszowka/simplecov
|
||||
require 'simplecov'
|
||||
SimpleCov.start 'rails' do
|
||||
add_group 'Models', ['app/models', 'app/validators']
|
||||
add_group 'Services & Workers', ['app/workers', 'app/services']
|
||||
end
|
||||
|
||||
require File.expand_path('../../config/environment', __FILE__)
|
||||
require 'rails/test_help'
|
||||
require "minitest/autorun"
|
||||
|
@ -2,16 +2,12 @@ require 'test_helper'
|
||||
|
||||
class CandidateQuizQuestionTest < ActiveSupport::TestCase
|
||||
def setup
|
||||
@row = {
|
||||
"candidate_id" => "12345",
|
||||
"quiz_id" => 9876,
|
||||
"question_id" => 5,
|
||||
"answer_id" => 6,
|
||||
"question" => 'what now?',
|
||||
"input_type" => 'text',
|
||||
"input_options" => %w(one two three).to_yaml,
|
||||
"answer" => { test: 1, foo: 'bar', cheer: 'huzzah!' }.to_yaml
|
||||
}
|
||||
@row = { "candidate_id" => "12345", "quiz_id" => 9876, "question_id" => 5, "answer_id" => 6,
|
||||
"input_type" => 'text', "question" => 'what now?',
|
||||
"input_options" => %w(one two three).to_yaml,
|
||||
"answer" => { test: 1, foo: 'bar', cheer: 'huzzah!' }.to_yaml,
|
||||
"saved" => false, "submitted" => true,
|
||||
"updated_at" => DateTime.parse('20160816') }
|
||||
end
|
||||
|
||||
test "propper dot attributes work" do
|
||||
@ -23,8 +19,15 @@ class CandidateQuizQuestionTest < ActiveSupport::TestCase
|
||||
assert_equal 6, question.answer_id
|
||||
assert_equal 'what now?', question.question
|
||||
assert_equal 'text', question.input_type
|
||||
assert_equal false, question.saved
|
||||
assert_equal true, question.submitted
|
||||
assert_equal DateTime.parse('20160816'), question.updated_at
|
||||
end
|
||||
|
||||
test 'should handle array of input options' do
|
||||
question = CandidateQuizQuestion.new @row
|
||||
|
||||
assert_kind_of Array, question.input_options
|
||||
assert_kind_of Hash, question.answer
|
||||
end
|
||||
|
||||
test "should handle string answer" do
|
||||
|
Reference in New Issue
Block a user