require File.expand_path(File.dirname(__FILE__) + '/../../test_helper') class ContactMailerHelperTest < ActionView::TestCase include ContactMailerHelper test "#render renders the correct html" do render_fields(fields_options).should == output_html end def fields_options { "fields" => { "field"=> [ {"name"=>"subject", "type"=>"text_field"}, {"name"=>"body", "type"=>"text_area"}, {"checked"=>"true", "name"=>"check me", "type"=>"radio_button", "value"=>"100"}, {"checked"=>"true", "name"=>"check me", "type"=>"check_box", "value"=>"100"}, {"name"=>"rating", "options"=> {"option"=> [{"value"=>"1", "label"=>"Very good"}, {"value"=>"5", "label"=>"Very bad"} ]}, "type"=>"select" } ] } } end def output_html <<-HTML

HTML end end # require 'rubygems' # require 'active_support' # # xml = %( #

Heading 2

#
#

Some text ...

#
# # # # # # # # # # # # # #
#

Some more text ...

#
# ) # # xml.scan(/(]*\/\s*>|]*>.*?<\/cell>)/m).each do |matches| # p Hash.from_xml(matches.first) # end