completes #62 - merges live_coder_text into live_coder

This commit is contained in:
Mark Moser
2016-08-11 17:44:30 -05:00
parent 33992d73c6
commit ccd287491d
6 changed files with 13 additions and 135 deletions

View File

@ -22,7 +22,7 @@ fed3:
quiz: fed
question: How would you create a widget that would fit in a 250px wide area as well as a 400px wide area?
category: CSS
input_type: live_code_text
input_type: live_code
input_options:
sort: 2
active: true

View File

@ -117,7 +117,7 @@ class AnswerFormatValidatorTest < ActiveSupport::TestCase
# input_type LIVE CODER
test "live_code should PASS with populated hash" do
obj = AnswerValidatable.new('live_code')
obj.answer = { html: 'this is html', css: '', js: '' }
obj.answer = { html: 'this is html', css: '', js: '', text: 'some reasons' }
assert obj.valid?
assert obj.errors.messages.empty?
@ -149,58 +149,17 @@ class AnswerFormatValidatorTest < ActiveSupport::TestCase
test "live_code should FAIL without values" do
obj = AnswerValidatable.new('live_code')
obj.answer = { later: "", html: "", css: "", js: "" }
refute obj.valid?
assert_match(/write.*code/, obj.errors.messages[:answer][0])
end
# input_type LIVE CODER TEXT
test "live_code_text should PASS with populated hash" do
obj = AnswerValidatable.new('live_code_text')
obj.answer = { html: 'this is html', css: '', js: '', text: 'some reasons' }
assert obj.valid?
assert obj.errors.messages.empty?
end
test "live_code_text should PASS with finish later" do
obj = AnswerValidatable.new('live_code_text')
obj.answer = { later: "true" }
assert obj.valid?
assert obj.errors.messages.empty?
end
test "live_code_text should FAIL with nil" do
obj = AnswerValidatable.new('live_code_text')
obj.answer = nil
refute obj.valid?
assert_match(/write.*code/, obj.errors.messages[:answer][0])
end
test "live_code_text should FAIL without checking finish later" do
obj = AnswerValidatable.new('live_code_text')
obj.answer = { later: "" }
refute obj.valid?
assert_match(/come back/, obj.errors.messages[:answer][0])
end
test "live_code_text should FAIL without values" do
obj = AnswerValidatable.new('live_code_text')
obj.answer = { later: "", html: "", css: "", js: "", text: "" }
refute obj.valid?
assert_match(/write.*code/, obj.errors.messages[:answer][0])
end
test "live_code_text should FAIL without text" do
obj = AnswerValidatable.new('live_code_text')
obj.answer = { later: "", html: "some html", css: "", js: "", text: "" }
test "live_code should PASS with text only" do
obj = AnswerValidatable.new('live_code')
obj.answer = { later: "", html: "", css: "", js: "", text: "reasons" }
refute obj.valid?
assert_match(/provide.*reason/, obj.errors.messages[:answer][0])
assert obj.valid?
assert obj.errors.messages.empty?
end
end