live coder seeding - completes #16

This commit is contained in:
Mark Moser
2016-08-23 21:54:53 -05:00
parent 393fd15ab5
commit 2b55fed1bc
12 changed files with 79 additions and 27 deletions

View File

@ -48,4 +48,20 @@ class AnswerFormatValidatorTest < ActiveSupport::TestCase
assert obj.valid?
assert obj.errors.messages.empty?
end
test "live_code should PASS using seed data" do
obj = AnswerValidatable.new('live_code', questions(:fed7).id)
obj.answer = { text: "no thanks", html: "<p>sample seed html</p>", css: "body { color: #644; }", js: "" }
assert obj.valid?
assert obj.errors.messages.empty?
end
test "live_code should FAIL with seed data only" do
obj = AnswerValidatable.new('live_code', questions(:fed7).id)
obj.answer = { text: "", html: "<p>sample seed html</p>", css: "body { color: #644; }", js: "" }
refute obj.valid?
assert_match(/write.*code/, obj.errors.messages[:answer][0])
end
end