[rspec-users] RSpec and simply_helpful

David Chelimsky dchelimsky at gmail.com
Wed Dec 13 04:12:10 EST 2006


On 12/13/06, David Goodlad <dgoodlad at gmail.com> wrote:
> Hi All
>
> I'm having some problems running my view specs when using
> simply_helpful.  I have it semi-working via the following:
>
> module SimplyHelpfulHelper
>   def self.included(base)
>     base.send :include, SimplyHelpful::RecordIdentificationHelper
>     base.send :include, SimplyHelpful::RecordTagHelper
>   end
> end
>
> context "The index template" do
>   setup do
>     @shift = mock("shift")
>     @shift.stub!(:class).and_return(Shift)
>     @shift.stub!(:id).and_return(1)
>
>     assigns[:shifts] = [@shift]
>   end
>
>   specify "should have a div tag for the shift" do
>     render 'shifts/index', :helper => 'simply_helpful'
>     response.should_have_tag 'div', :attributes => { :id => 'shift_1' }
>   end
> end
>
> My template just makes a call like this:
>
> <%= render :partial => @shifts %>
>
> I've done some experimentation, and it seems that RSpec's
> implementation of 'render_partial' is rewriting the partial path
> trying to be smart about it but breaking things.  The partial_path,
> once it reaches render_partial_with_record_identification, ends up
> being "/shifts//#<Spec::Mocks::Mock:0x28450cc>".  This is caused by
> the method being overwritten in
> rspec_on_rails/lib/extensions/action_view/base.rb.
>
> I suggest that there be a second condition attached to the unless
> statement on line 5, to ensure that the partial_path is a String; if
> it is not, the partial_path should be passed straight on through...
>
> Thoughts?

Dave - it would be quite awesome if you would submit a patch for this w/ specs.

Thanks,
David

>
> Dave
>
> --
> Dave Goodlad
> dgoodlad at gmail.com or dave at goodlad.ca
> http://david.goodlad.ca/
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>


More information about the rspec-users mailing list