test/unit/zena/use/fulltext_test.rb in zena-1.0.0.beta3 vs test/unit/zena/use/fulltext_test.rb in zena-1.0.0.rc1
- old
+ new
@@ -16,12 +16,20 @@
secure(VirtualClass) { virtual_classes(:Letter) }
end
context 'with valid code' do
should 'succeed' do
- assert subject.update_attributes(:idx_text_high => %q{sender:#{title} paper:#{paper}})
+ assert subject.update_attributes(:idx_text_high => %q{%Q{sender:#{title} paper:#{paper}}})
+ assert_equal %q{%Q{sender:#{title} paper:#{paper}}}, subject.idx_text_high
end
end # with valid code
+
+ context 'with invalid return type' do
+ should 'fail' do
+ assert !subject.update_attributes(:idx_text_high => '89')
+ assert_match %r{Compilation should produce a String. Found Number.}, subject.errors[:idx_text_high]
+ end
+ end # with invalid return type
context 'with syntax errors' do
should 'fail' do
assert !subject.update_attributes(:idx_text_high => %q[foo:#{tit}le} paper:#{paper}])
assert_match %r{parse error}, subject.errors[:idx_text_high]