[rspec-users] Specifying custom rails FormBuilders

David Chelimsky dchelimsky at gmail.com
Mon Aug 6 12:23:06 EDT 2007


On 8/6/07, Jay Levitt <lists-rspec at shopwatch.org> wrote:
> I want to write a spec for a custom form builder, but I'm not really
> sure where it should live or how to include the right rspec_on_rails
> contexts.  Ideally, I should be able to write a spec like:
>
>
> describe LabelledBuilder do
>
>   it "should let me create a text field" do
>     object = mock(object)
>     object.stub!(:attribute).and_return("Test String")
>
>     render :inline =>
>       "<% form_for(@object, :builder => LabelledBuilder) do |f| -%>
>         <%= f.text_field :attribute %>
>        <% end %>"
>
>     response.should have_tag("label")
>   end
> end
>
>
> but I'm not having much luck.

How so? What error do you get from that?

> Can anyone give me an idea where to start?
>
> Jay
>
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>


More information about the rspec-users mailing list