test/buildmaster/templatelets/tc_href.rb in BuildMaster-0.8.1 vs test/buildmaster/templatelets/tc_href.rb in BuildMaster-0.9.0

- old
+ new

@@ -3,53 +3,54 @@ require 'common_templatelet_test' $:.unshift File.join(File.dirname(__FILE__), '..', '..', '..', 'lib') module BuildMaster -class HrefTest < CommonTemplateletTest - def setup - super +context 'HrefTest' do + include HelperMethods + setup do + setup_spec @template_element = create_element('href') @target_element = create_element('a') @href = Href.new(@site_spec) end def source(path) SourceContent.new(Pathname.new(path), nil) end - def test_should_populate_href_attribute_with_full_url + specify 'should_populate_href_attribute_with_full_url' do expected_url = 'http://www.rubyforge.org' @template_element.attributes['url']=expected_url @href.process(@target_element, @template_element, source('index.html')) - assert_equal(expected_url, @target_element.attributes['href']) + @target_element.attributes['href'].should_equal expected_url end - def test_should_populate_href_attribute_with_relative_path + specify 'should_populate_href_attribute_with_relative_path' do @template_element.attributes['url']='doc/doc.html' @href.process(@target_element, @template_element, source('download/index.html')) - assert_equal('../doc/doc.html', @target_element.attributes['href']) + @target_element.attributes['href'].should_equal '../doc/doc.html' end - def test_should_support_image_tag_by_generating_src_attribute + specify 'should_support_image_tag_by_generating_src_attribute' do @template_element.attributes['url']='doc/doc.gif' @target_element = create_element('img') @href.process(@target_element, @template_element, source('download/download.html')) - assert_equal('../doc/doc.gif', @target_element.attributes['src']) + @target_element.attributes['src'].should_equal '../doc/doc.gif' end - def test_should_handle_external_links + specify 'should_handle_external_links' do @template_element.attributes['url'] = 'http://www.google.com' @target_element = create_element('img') @href.process(@target_element, @template_element, source('download/download.html')) - assert_equal('http://www.google.com', @target_element.attributes['src']) + @target_element.attributes['src'].should_equal 'http://www.google.com' end - def test_should_handle_absolute_path + specify 'should_handle_absolute_path' do @template_element.attributes['url'] = '/doc.html' @target_element = create_element('img') @href.process(@target_element, @template_element, source('download/download.html')) - assert_equal('../doc.html', @target_element.attributes['src']) + @target_element.attributes['src'].should_equal '../doc.html' end end end