I'm trying to set up and run a new form builder under rails, which lives
under the helpers directory, but isn't really a helper.  (Not a module, so
doesn't mix in well)

Short of dropping down into a view spec, how do I set up to actually spec
the form builder?

describe RandomFormBuilder do
  attr_reader  :builder
  before do
    @object = mock_model(Foo)
    @builder = RandomFormBuilder.new(:foo, @object, #template#, {}, nil)
  end

  describe "#text_field" do
    it "should have a label" do
       @builder.text_field(:foo).should have_tag("label", "Foo")
    end
  end
end

class RandomFormBuilder < ActionView::Helpers::FormBuilder
  def  text_field(method, *args)
    label(method)
    super(method, *args)
  end
end

That's sort of what I've got at the moment.  #template# supposed to be an
object with access to all the normal helpers, I _think_.
using helper in that location gives me a NoMethodError.

using self in that location ends up with the helper trying to delegate
methods to Spec::Rails::Example::RailsExampleGroup::Subclass ....


has anybody figured out what hoops this needs?

-- 
// anything worth taking seriously is worth making fun of
// http://blog.devcaffeine.com/
_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to