test/buildmaster/templatelets/tc_when.rb in BuildMaster-0.8.1 vs test/buildmaster/templatelets/tc_when.rb in BuildMaster-0.9.0
- old
+ new
@@ -8,12 +8,18 @@
require 'rexml/xpath'
require 'buildmaster/site_spec'
require 'buildmaster/templatelets'
module BuildMaster
-class WhenTest < CommonTemplateletTest
- def test_should_process_child_when_evaluated_true
+context 'WhenTest' do
+ include HelperMethods
+
+ setup do
+ setup_spec
+ end
+
+ specify 'should_process_child_when_evaluated_true' do
target = create_element('target')
template_content = <<CONTENT
<when test='expression_for_true'>
<h1>Header</h1>
</when>
@@ -21,24 +27,24 @@
template_document = REXML::Document.new(template_content)
template = REXML::XPath.first(template_document, '/when')
when_processor = When.new(self, self)
when_processor.process(target, template, self)
actual = REXML::XPath.first(target, 'h1')
- assert_equal('Header', actual.text)
+ actual.text.should_equal 'Header'
end
- def test_should_not_process_child_when_evaluated_false
+ specify 'should_not_process_child_when_evaluated_false' do
target = create_element('target')
template_content = <<CONTENT
<when test='expression_for_false'>
<h1>Header</h1>
</when>
CONTENT
template_document = REXML::Document.new(template_content)
template = REXML::XPath.first(template_document, '/when')
when_processor = When.new(self, self)
when_processor.process(target, template, self)
- assert_equal(0, target.size)
+ target.size.should_equal 0
end
def path
return Pathname.new('index.html')
end