require 'html/spec_helper' describe "FormHelper" do before do class MockFormHelperContext < Rad::MockTemplateContext include Rad::Html::FormHelper end @t = MockFormHelperContext.new end it "check_box_tag" do @t.check_box_tag('item').should == %() end it "field_set_tag" do @t.field_set_tag{'content'}.should == %(
) end it "file_field_tag" do @t.file_field_tag('item').should == %() end if String.method_defined? :to_xhtml it "form_tag" do @t.form_tag(id: 'the_form', action: '/'){"content"} @t.buffer.to_xhtml('#the_form').to_fuzzy_hash.should == {id: 'the_form', action: '/', content: 'content', method: 'post'} end else warn "WARN: skipping spec" end it "hidden_field_tag" do @t.hidden_field_tag('item', 'hidden value').should == %() end it "password_field_tag" do @t.password_field_tag('item').should == %() end it "radio_button_tag" do @t.radio_button_tag('item').should == %() end it "select_tag" do @t.select_tag('item', nil, [["Dollar", "$"], ["Kroner", "DKK"]]).should == %() @t.select_tag('item', '$', [["Dollar", "$"], ["Kroner", "DKK"]], class: 'highlight').should == %() end it "submit_tag" do @t.submit_tag('ok').should == %() end it "text_field_tag" do @t.text_field_tag('item', 'value').should == %() end it "text_area_tag" do @t.text_area_tag('item', 'value').should == %() end end