Changeset 729

Show
Ignore:
Timestamp:
10/08/07 01:24:27 (1 year ago)
Author:
wyca..@gmail.com
Message:

might be a working prototype form helper... or might not be... to be continued

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • plugins/merb_helpers/lib/form_helpers.rb

    r710 r729  
    1919       
    2020      def form_for(obj, &block) 
     21        concat("<form>", block.binding) 
    2122        self.instance_eval do 
    2223          @obj = instance_variable_get("@#{obj}") 
     
    2526          block.call 
    2627        end 
    27         capture(block) 
     28        concat("</form>", block.binding)         
    2829      end 
    2930       
  • plugins/merb_helpers/specs/merb_helpers_spec.rb

    r710 r729  
    5858  before :each do 
    5959    @obj = FakeModel.new 
     60    def _buffer(buf) @buffer ||= "" end     
    6061  end 
    6162   
    6263  it "should take a string object and return a useful text control" do 
    6364    f = form_for :obj do 
    64       text_control(:foo).should == "<input type='text' name='obj[foo]' value='foowee'/>" 
     65      text_control(:foo).should == "<form><input type='text' name='obj[foo]' value='foowee'/>" 
    6566    end 
    66     f.should == "...
     67    f.should == "<form><input type='text' name='obj[foo]' value='foowee'/></form>
    6768  end 
    6869